From 5ad93ab573dbe9555db0c1b9ab26de6672e7cb07 Mon Sep 17 00:00:00 2001 From: Carter Allen Date: Sun, 26 Dec 2010 17:32:04 -0700 Subject: [PATCH] Fix tests when spaces are in path --- test/simple/test-cli-eval.js | 2 +- test/simple/test-error-reporting.js | 2 +- test/simple/test-http-curl-chunk-problem.js | 2 +- test/simple/test-pipe-head.js | 2 +- test/simple/test-stdin-from-file.js | 2 +- test/simple/test-stdout-to-file.js | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/simple/test-cli-eval.js b/test/simple/test-cli-eval.js index ec4cf32855..c4e9247f2a 100644 --- a/test/simple/test-cli-eval.js +++ b/test/simple/test-cli-eval.js @@ -1,7 +1,7 @@ assert = require('assert'); child = require('child_process'); -nodejs = process.execPath; +nodejs = '"' + process.execPath + '"'; if (module.parent) { // signal we've been loaded as a module diff --git a/test/simple/test-error-reporting.js b/test/simple/test-error-reporting.js index 6c9ea5eb7d..bdfab22ed3 100644 --- a/test/simple/test-error-reporting.js +++ b/test/simple/test-error-reporting.js @@ -6,7 +6,7 @@ var path = require('path'); var exits = 0; function errExec(script, callback) { - var cmd = process.argv[0] + ' ' + path.join(common.fixturesDir, script); + var cmd = '"' + process.argv[0] + '" "' + path.join(common.fixturesDir, script) + '"'; return exec(cmd, function(err, stdout, stderr) { // There was some error assert.ok(err); diff --git a/test/simple/test-http-curl-chunk-problem.js b/test/simple/test-http-curl-chunk-problem.js index 30b8a981f1..654053bf37 100644 --- a/test/simple/test-http-curl-chunk-problem.js +++ b/test/simple/test-http-curl-chunk-problem.js @@ -22,7 +22,7 @@ function maybeMakeRequest() { } -cp.exec('dd if=/dev/zero of=' + filename + ' bs=1024 count=10240', +cp.exec('dd if=/dev/zero of="' + filename + '" bs=1024 count=10240', function(err, stdout, stderr) { if (err) throw err; maybeMakeRequest(); diff --git a/test/simple/test-pipe-head.js b/test/simple/test-pipe-head.js index 5fe595de7f..a77e739e15 100644 --- a/test/simple/test-pipe-head.js +++ b/test/simple/test-pipe-head.js @@ -7,7 +7,7 @@ var join = require('path').join; var nodePath = process.argv[0]; var script = join(common.fixturesDir, 'print-10-lines.js'); -var cmd = nodePath + ' ' + script + ' | head -2'; +var cmd = '"' + nodePath + '" "' + script + '" | head -2'; var finished = false; diff --git a/test/simple/test-stdin-from-file.js b/test/simple/test-stdin-from-file.js index 40e9093c3f..b429fb7211 100644 --- a/test/simple/test-stdin-from-file.js +++ b/test/simple/test-stdin-from-file.js @@ -7,7 +7,7 @@ var fs = require('fs'); var stdoutScript = join(common.fixturesDir, 'echo.js'); var tmpFile = join(common.fixturesDir, 'stdin.txt'); -var cmd = process.argv[0] + ' ' + stdoutScript + ' < ' + tmpFile; +var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' + tmpFile + '"'; var string = 'abc\nümlaut.\nsomething else\n' + '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' + diff --git a/test/simple/test-stdout-to-file.js b/test/simple/test-stdout-to-file.js index a8d5357727..44206589a2 100644 --- a/test/simple/test-stdout-to-file.js +++ b/test/simple/test-stdout-to-file.js @@ -9,13 +9,13 @@ var scriptBuffer = path.join(common.fixturesDir, 'print-chars-from-buffer.js'); var tmpFile = path.join(common.fixturesDir, 'stdout.txt'); function test(size, useBuffer, cb) { - var cmd = process.argv[0] + + var cmd = '"' + process.argv[0] + '"' + ' ' + - (useBuffer ? scriptBuffer : scriptString) + + '"' + (useBuffer ? scriptBuffer : scriptString) + '"' + ' ' + size + ' > ' + - tmpFile; + '"' + tmpFile + '"'; try { fs.unlinkSync(tmpFile);