Skip to content

Commit 82f067e

Browse files
Shigeki Ohtsupiscisaureus
Shigeki Ohtsu
authored andcommitted
test: fix ext commands to be double quoted
Paths used on the Windows command line need to be enclosed in double quotes, or they'll be parsed incorrectly when there are spaces in the path. PR-URL: #1122 Reviewed-by: Bert Belder <[email protected]>
1 parent 5ecdc03 commit 82f067e

10 files changed

+16
-17
lines changed

test/parallel/test-eval.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var exec = require('child_process').exec;
66
var success_count = 0;
77
var error_count = 0;
88

9-
var cmd = [process.execPath, '-e', '"console.error(process.argv)"',
9+
var cmd = ['"' + process.execPath + '"', '-e', '"console.error(process.argv)"',
1010
'foo', 'bar'].join(' ');
1111
var expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
1212
var child = exec(cmd, function(err, stdout, stderr) {

test/parallel/test-fs-readfile-error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var callbacks = 0;
1414

1515
function test(env, cb) {
1616
var filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
17-
var execPath = process.execPath + ' ' + filename;
17+
var execPath = '"' + process.execPath + '" "' + filename + '"';
1818
var options = { env: env || {} };
1919
exec(execPath, options, function(err, stdout, stderr) {
2020
assert(err);

test/parallel/test-http-curl-chunk-problem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var count = 0;
1616
function maybeMakeRequest() {
1717
if (++count < 2) return;
1818
console.log('making curl request');
19-
var cmd = 'curl http://127.0.0.1:' + common.PORT + '/ | ' + common.opensslCli + ' sha1';
19+
var cmd = 'curl http://127.0.0.1:' + common.PORT + '/ | ' +
20+
'"' + common.opensslCli + '" sha1';
2021
cp.exec(cmd, function(err, stdout, stderr) {
2122
if (err) throw err;
2223
var hex = stdout.match(/([A-Fa-f0-9]{40})/)[0];

test/parallel/test-tls-ecdh-disable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var server = tls.createServer(options, function(conn) {
2929
});
3030

3131
server.listen(common.PORT, '127.0.0.1', function() {
32-
var cmd = common.opensslCli + ' s_client -cipher ' + options.ciphers +
32+
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
3333
' -connect 127.0.0.1:' + common.PORT;
3434

3535
exec(cmd, function(err, stdout, stderr) {

test/parallel/test-tls-ecdh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var server = tls.createServer(options, function(conn) {
3232
});
3333

3434
server.listen(common.PORT, '127.0.0.1', function() {
35-
var cmd = common.opensslCli + ' s_client -cipher ' + options.ciphers +
35+
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
3636
' -connect 127.0.0.1:' + common.PORT;
3737

3838
exec(cmd, function(err, stdout, stderr) {

test/parallel/test-tls-set-ciphers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var server = tls.createServer(options, function(conn) {
3636
});
3737

3838
server.listen(common.PORT, '127.0.0.1', function() {
39-
var cmd = common.opensslCli + ' s_client -cipher ' + options.ciphers +
39+
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
4040
' -connect 127.0.0.1:' + common.PORT;
4141

4242
exec(cmd, function(err, stdout, stderr) {

test/pummel/test-exec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var success_count = 0;
1616
var error_count = 0;
1717

1818

19-
exec(process.execPath + ' -p -e process.versions',
19+
exec('"' + process.execPath + '" -p -e process.versions',
2020
function(err, stdout, stderr) {
2121
if (err) {
2222
error_count++;

test/sequential/test-child-process-execsync.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var err;
1414
var caught = false;
1515
try
1616
{
17-
var cmd = util.format('%s -e "setTimeout(function(){}, %d);"',
17+
var cmd = util.format('"%s" -e "setTimeout(function(){}, %d);"',
1818
process.execPath, SLEEP);
1919
var ret = execSync(cmd, {timeout: TIMER});
2020
} catch (e) {
@@ -37,7 +37,7 @@ var msg = 'foobar';
3737
var msgBuf = new Buffer(msg + '\n');
3838

3939
// console.log ends every line with just '\n', even on Windows.
40-
cmd = util.format('%s -e "console.log(\'%s\');"', process.execPath, msg);
40+
cmd = util.format('"%s" -e "console.log(\'%s\');"', process.execPath, msg);
4141

4242
var ret = execSync(cmd);
4343

test/sequential/test-init.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
var envCopy = JSON.parse(JSON.stringify(process.env));
1515
envCopy.TEST_INIT = 1;
1616

17-
child.exec(process.execPath + ' test-init', {env: envCopy},
17+
child.exec('"' + process.execPath + '" test-init', {env: envCopy},
1818
function(err, stdout, stderr) {
1919
assert.equal(stdout, 'Loaded successfully!',
2020
'`node test-init` failed!');
2121
});
22-
child.exec(process.execPath + ' test-init.js', {env: envCopy},
22+
child.exec('"' + process.execPath + '" test-init.js', {env: envCopy},
2323
function(err, stdout, stderr) {
2424
assert.equal(stdout, 'Loaded successfully!',
2525
'`node test-init.js` failed!');
@@ -28,7 +28,7 @@
2828
// test-init-index is in fixtures dir as requested by ry, so go there
2929
process.chdir(common.fixturesDir);
3030

31-
child.exec(process.execPath + ' test-init-index', {env: envCopy},
31+
child.exec('"' + process.execPath + '" test-init-index', {env: envCopy},
3232
function(err, stdout, stderr) {
3333
assert.equal(stdout, 'Loaded successfully!',
3434
'`node test-init-index failed!');
@@ -39,7 +39,7 @@
3939
// expected in node
4040
process.chdir(common.fixturesDir + '/test-init-native/');
4141

42-
child.exec(process.execPath + ' fs', {env: envCopy},
42+
child.exec('"' + process.execPath + '" fs', {env: envCopy},
4343
function(err, stdout, stderr) {
4444
assert.equal(stdout, 'fs loaded successfully',
4545
'`node fs` failed!');

test/sequential/test-regress-GH-4015.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ var common = require('../common');
22
var assert = require('assert');
33
var exec = require('child_process').exec;
44

5-
var cmd = process.execPath
6-
+ ' '
7-
+ common.fixturesDir
8-
+ '/test-regress-GH-4015.js';
5+
var cmd = '"' + process.execPath + '" ' +
6+
'"' + common.fixturesDir + '/test-regress-GH-4015.js"';
97

108
exec(cmd, function(err, stdout, stderr) {
119
assert(/RangeError: Maximum call stack size exceeded/.test(stderr));

0 commit comments

Comments
 (0)