diff options
-rw-r--r-- | lib/run-script.js | 3 | ||||
-rw-r--r-- | test/tap/run-script.js | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/run-script.js b/lib/run-script.js index b6aa5fe7e..bf72bf814 100644 --- a/lib/run-script.js +++ b/lib/run-script.js @@ -189,8 +189,7 @@ function run (pkg, wd, cmd, args, cb) { function joinArgs (args) { var joinedArgs = "" args.forEach(function(arg) { - if (arg.match(/[ '"]/)) arg = '"' + arg.replace(/"/g, '\\"') + '"' - joinedArgs += " " + arg + joinedArgs += ' "' + arg.replace(/"/g, '\\"') + '"' }) return joinedArgs } diff --git a/test/tap/run-script.js b/test/tap/run-script.js index 35790684f..60c9d3c4f 100644 --- a/test/tap/run-script.js +++ b/test/tap/run-script.js @@ -111,6 +111,10 @@ test('npm run-script with args that contain double quotes', function (t) { common.npm(['run-script', 'start', '--', 'what"s "up"?'], opts, testOutput.bind(null, t, 'what"s "up"?')) }) +test('npm run-script with args that contain ticks', function (t) { + common.npm(['run-script', 'start', '--', 'what\'s \'up\'?'], opts, testOutput.bind(null, t, 'what\'s \'up\'?')) +}) + test('npm run-script with pre script', function (t) { common.npm(['run-script', 'with-post'], opts, testOutput.bind(null, t, 'main;post')) }) |