|
|
@ -33,9 +33,13 @@ var returns = 0; |
|
|
|
(after removing traling whitespace) |
|
|
|
*/ |
|
|
|
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.addListener('data', function(chunk) { |
|
|
@ -52,8 +56,13 @@ function testCwd(options, forCode, forData) { |
|
|
|
} |
|
|
|
|
|
|
|
// Assume these exist, and 'pwd' gives us the right directory back
|
|
|
|
testCwd({cwd: '/dev'}, 0, '/dev'); |
|
|
|
testCwd({cwd: '/'}, 0, '/'); |
|
|
|
if (process.platform == "win32") { |
|
|
|
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
|
|
|
|
testCwd({cwd: 'does-not-exist'}, 127); |
|
|
|