From: Bert Belder Date: Tue, 2 Aug 2011 01:19:57 +0000 (+0200) Subject: Partial fix for test-child-process.cwd on windows X-Git-Tag: v0.5.3~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70bf121f21c03d398a0d3c60e2088c29ff5a0b1b;p=platform%2Fupstream%2Fnodejs.git Partial fix for test-child-process.cwd on windows --- diff --git a/test/simple/test-child-process-cwd.js b/test/simple/test-child-process-cwd.js index eeca22e7a..5fc5c07d5 100644 --- a/test/simple/test-child-process-cwd.js +++ b/test/simple/test-child-process-cwd.js @@ -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);