Browse Source

x-platform func for spawning pwd in tests

Fixes test-child-process-buffering
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
4983bd348d
  1. 10
      test/common.js
  2. 2
      test/simple/test-child-process-buffering.js
  3. 9
      test/simple/test-child-process-cwd.js

10
test/common.js

@ -61,6 +61,16 @@ exports.ddCommand = function(filename, kilobytes) {
};
exports.spawnPwd = function(options) {
var spawn = require('child_process').spawn;
if (process.platform == "win32") {
return spawn('cmd.exe', ['/c', 'cd'], options);
} else {
return spawn('pwd', [], options);
}
};
// Turn this off if the test should not check for global leaks.
exports.globalCheck = true;

2
test/simple/test-child-process-buffering.js

@ -28,7 +28,7 @@ var pwd_called = false;
function pwd(callback) {
var output = '';
var child = spawn('pwd');
var child = common.spawnPwd();
child.stdout.setEncoding('utf8');
child.stdout.addListener('data', function(s) {

9
test/simple/test-child-process-cwd.js

@ -33,13 +33,10 @@ var returns = 0;
(after removing traling whitespace)
*/
function testCwd(options, forCode, forData) {
var child, data = '';
var data = '';
var child = common.spawnPwd(options);
if (process.platform == "win32") {
child = spawn('cmd.exe', ['/c', 'cd'], options);
} else {
child = spawn('pwd', [], options);
}
child.stdout.setEncoding('utf8');
child.stdout.addListener('data', function(chunk) {

Loading…
Cancel
Save