Skip to content

Commit

Permalink
Fix URLs in WSL (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma committed Jan 29, 2020
1 parent 1083cce commit d8a508b
Showing 1 changed file with 12 additions and 10 deletions.
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

0 comments on commit d8a508b

Please sign in to comment.