Fix tests when spaces are in path
authorCarter Allen <CarterA@opt-6.com>
Mon, 27 Dec 2010 00:32:04 +0000 (17:32 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Tue, 25 Jan 2011 20:56:35 +0000 (12:56 -0800)
test/simple/test-cli-eval.js
test/simple/test-error-reporting.js
test/simple/test-http-curl-chunk-problem.js
test/simple/test-pipe-head.js
test/simple/test-stdin-from-file.js
test/simple/test-stdout-to-file.js

index ec4cf32..c4e9247 100644 (file)
@@ -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
index 6c9ea5e..bdfab22 100644 (file)
@@ -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);
index 30b8a98..654053b 100644 (file)
@@ -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();
index 5fe595d..a77e739 100644 (file)
@@ -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;
 
index 40e9093..b429fb7 100644 (file)
@@ -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年存在于岭南地区的一个国家,国都位于番禺,' +
index a8d5357..4420658 100644 (file)
@@ -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);