Skip to content
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

Fix URLs in WSL #166

Merged
merged 1 commit into from Jan 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 12 additions & 10 deletions index.js
Expand Up @@ -65,16 +65,18 @@ module.exports = async (target, options) => {
command = 'cmd' + (isWsl ? '.exe' : '');
cliArguments.push('/s', '/c', 'start', '""', '/b');

// Always quoting target allows for URLs/paths to have spaces and unmarked characters, as `cmd.exe` will
// interpret them as plain text to be forwarded as one unique argument. Enabling `windowsVerbatimArguments`
// disables Node.js's default quotes and escapes handling (https://git.io/fjdem).
// References:
// - Issues #17, #44, #55, #77, #101, #115
// - Pull requests: #74, #98
//
// As a result, all double-quotes are stripped from the `target` and do not get to your desired destination.
target = `"${target}"`;
childProcessOptions.windowsVerbatimArguments = true;
if (!isWsl) {
// Always quoting target allows for URLs/paths to have spaces and unmarked characters, as `cmd.exe` will
// interpret them as plain text to be forwarded as one unique argument. Enabling `windowsVerbatimArguments`
// disables Node.js's default quotes and escapes handling (https://git.io/fjdem).
// References:
// - Issues #17, #44, #55, #77, #101, #115
// - Pull requests: #74, #98
//
// As a result, all double-quotes are stripped from the `target` and do not get to your desired destination.
target = `"${target}"`;
childProcessOptions.windowsVerbatimArguments = true;
}

if (options.wait) {
cliArguments.push('/wait');
Expand Down