-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove NodeJS v0.10 and v0.12 support - Change escaping on Windows to use `^` instead of quotes: - Fix a bug that made it impossible to escape an argument that contained quotes followed by `>` or other special chars, e.g.: `"foo|bar"`, fixes #82 - Fix a bug were a command containing `%x%` would be replaced with the contents of the `x` environment variable, fixes #51 - Add a work around for a NodeJS bug when spawning a command with spaces when `options.shell` was enabled, fixes #77 - Fix `options` argument being mutated - Remove support for running `echo` on Windows
- Loading branch information
Showing
21 changed files
with
1,442 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"@satazor/eslint-config/es5", | ||
"@satazor/eslint-config/es6", | ||
"@satazor/eslint-config/addons/node" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
- '0.12' | ||
- '4' | ||
- '6' | ||
- '7' | ||
- 'node' | ||
- 'lts/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
'use strict'; | ||
|
||
function escapeArgument(arg, quote) { | ||
const isWin = process.platform === 'win32'; | ||
|
||
function escapeArgumentWindows(arg) { | ||
// Convert to string | ||
arg = '' + arg; | ||
|
||
// If we are not going to quote the argument, | ||
// escape shell metacharacters, including double and single quotes: | ||
if (!quote) { | ||
arg = arg.replace(/([()%!^<>&|;,"'\s])/g, '^$1'); | ||
} else { | ||
// Sequence of backslashes followed by a double quote: | ||
// double up all the backslashes and escape the double quote | ||
arg = arg.replace(/(\\*)"/g, '$1$1\\"'); | ||
|
||
// Sequence of backslashes followed by the end of the string | ||
// (which will become a double quote later): | ||
// double up all the backslashes | ||
arg = arg.replace(/(\\*)$/, '$1$1'); | ||
|
||
// All other backslashes occur literally | ||
|
||
// Quote the whole thing: | ||
arg = '"' + arg + '"'; | ||
} | ||
arg = `${arg}`; | ||
|
||
// Escape quotes with \^ | ||
arg = arg.replace(/"/g, '\\^$1'); | ||
|
||
// Escape other meta chars with ^ | ||
arg = arg.replace(/([()%!^<>&|;,\s])/g, '^$1'); | ||
|
||
return arg; | ||
} | ||
|
||
module.exports = escapeArgument; | ||
function escapeArgumentUnix(arg) { | ||
if (/^[a-z0-9_-]+$/i.test(arg)) { | ||
return arg; | ||
} | ||
|
||
return `"${arg.replace('\'', "'\\'")}"`; | ||
} | ||
|
||
module.exports = isWin ? escapeArgumentWindows : escapeArgumentUnix; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.