-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The quotation in cmd of Deno.run #8852
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Not stale. |
This seems expected, and rather a limitation of the CLIs of the applications being run. Does Node have different behaviour? |
It's not a CLI limitation. And, yes, it's up to the target executable to interpret it, but any arbitrary command line string should be generable by the runtime. This is definitely a problem when spawning child processes with arbitrary command lines on Windows. It is subtle and occurs as random command lines which panic with weird quoting errors (as the examples noted above). It's very problematic when trying to work around the windows It's, unfortunately, a complicated issue. (Here's an issue that references some 'light' reading on the subject.) Given the architecture and goals of Deno, I'm not sure of the best course forward. But I do think that some way to execute arbitrary command lines in Windows should be part of the Deno runtime, even if it's more complicated. |
@nayeemrmn , here's a simple, specific example of why this is a problem...
... Currently, it's impossible to execute certain valid Windows command lines in Deno. For example, C:>cmd /d/c "deno eval -T "console.log('a string')""
Check file:///C:/Users/Roy/OneDrive/Projects/deno/$deno$eval.ts
a string when implemented via await Deno.run({cmd: ['cmd', '/d/c', '"deno eval -T "console.log(\'a string\')""']}).status();
// => `The system cannot find the path specified.` or ... await Deno.run({cmd: ['cmd', '/d/c', 'deno eval -T "console.log(\'a string\')"']}).status();
// => `error: Unterminated string constant at file:///C:/Users/Roy/OneDrive/Projects/deno/$deno$eval.ts:1:0` It's not possible to construct this command line because the inner double quotes are escaped, which, in turn, breaks the interpretation by ... Notably, |
@nayeemrmn , can you re-open this? |
I'm not a maintainer (cc @lucacasonato). The issue seems valid, if |
any progress on this? |
Rust actually has raw_arg. We could use that. |
I am running into many issues with Deno.run as well. Running commands like This command is also seemingly impossible to run: A viable workaround would be to echo the command into a |
In Node.js, child_process.spawn has And that option is used by cross-spawn npm module. ref: https://github.com/moxystudio/node-cross-spawn/blob/5d843849e1ed434b7030e0aa49281c2bf4ad2e71/lib/parse.js#L59 This issue causes the usage of cross-spawn (via compat feat) always failing on windows. |
This change adds `windowsRawArguments` to `SpawnOptions`. The option enables skipping the default quoting and escaping while creating the command on windows. The option works in a similar way as `windowsVerbatimArguments` in child_process.spawn options in Node.js, and is necessary for simulating it in `std/node`. closes #8852
This change adds `windowsRawArguments` to `SpawnOptions`. The option enables skipping the default quoting and escaping while creating the command on windows. The option works in a similar way as `windowsVerbatimArguments` in child_process.spawn options in Node.js, and is necessary for simulating it in `std/node`. closes #8852
" in the result has been replaced by \"
"" or \" in the result has been replaced by \"\"
The text was updated successfully, but these errors were encountered: