Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions apps/server/src/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,16 @@ export const launchDetached = (launch: EditorLaunch) =>
yield* Effect.callback<void, OpenError>((resume) => {
let child;
try {
child = spawn(launch.command, [...launch.args], {
detached: true,
stdio: "ignore",
shell: process.platform === "win32",
});
const isWin32 = process.platform === "win32";
child = spawn(
launch.command,
isWin32 ? launch.args.map((a) => `"${a}"`) : [...launch.args],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if i have a path with " in?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directories with quote " are properly opened, but with the caveat that I had to create the directory from WSL on /mnt/c as I could not create it directly in Windows.

Project in T3 Code:

image

Before Pull Request:

image

After Pull Request:

image

Repro Steps:

I get an error when I try to create a directory with a quote " within Windows:

cd C:\t3code-pr-1805\
mkdir 'dir with " quotes "'
# ERROR: New-Item: The filename, directory name, or volume label syntax is incorrect. : 'C:\t3code-pr-1805\dir with " quotes "'.

So I used WSL on the Windows mount:

cd /mnt/c/t3code-pr-1805
mkdir 'dir with " quotes "'
ls 
# 'dir with " quotes "'
touch 'dir with " quotes "'/dummy-file.md

But viewing it from Windows shows the quote charaters actually as U+F022 (Private Use Area):
image
image

Get-ChildItem C:\t3code-pr-1805\ -Name | ForEach-Object { $_; ($_.ToCharArray() | ForEach-Object { '{0} U+{1:X4}' -f $_, [int][char]$_ }) }
dir with  quotes 
d U+0064
i U+0069
r U+0072
  U+0020
w U+0077
i U+0069
t U+0074
h U+0068
  U+0020
 U+F022
  U+0020
q U+0071
u U+0075
o U+006F
t U+0074
e U+0065
s U+0073
  U+0020
 U+F022

{
detached: true,
stdio: "ignore",
shell: isWin32,
},
);
} catch (error) {
return resume(
Effect.fail(new OpenError({ message: "failed to spawn detached process", cause: error })),
Expand Down
Loading