Browse Source

Partial fix for test-child-process.cwd on windows

v0.7.4-release
Bert Belder 14 years ago
parent
commit
70bf121f21
  1. 17
      test/simple/test-child-process-cwd.js

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

@ -33,9 +33,13 @@ var returns = 0;
(after removing traling whitespace) (after removing traling whitespace)
*/ */
function testCwd(options, forCode, forData) { function testCwd(options, forCode, forData) {
var data = ''; var child, data = '';
var child = spawn('pwd', [], options); if (process.platform == "win32") {
child = spawn('cmd.exe', ['/c', 'cd'], options);
} else {
child = spawn('pwd', [], options);
}
child.stdout.setEncoding('utf8'); child.stdout.setEncoding('utf8');
child.stdout.addListener('data', function(chunk) { child.stdout.addListener('data', function(chunk) {
@ -52,8 +56,13 @@ function testCwd(options, forCode, forData) {
} }
// Assume these exist, and 'pwd' gives us the right directory back // Assume these exist, and 'pwd' gives us the right directory back
testCwd({cwd: '/dev'}, 0, '/dev'); if (process.platform == "win32") {
testCwd({cwd: '/'}, 0, '/'); testCwd({cwd: process.env.windir}, 0, process.env.windir);
testCwd({cwd: 'c:\\'}, 0, 'c:\\');
} else {
testCwd({cwd: '/dev'}, 0, '/dev');
testCwd({cwd: '/'}, 0, '/');
}
// Assume this doesn't exist, we expect exitcode=127 // Assume this doesn't exist, we expect exitcode=127
testCwd({cwd: 'does-not-exist'}, 127); testCwd({cwd: 'does-not-exist'}, 127);

Loading…
Cancel
Save