-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: don't error at startup when cwd doesn't exist
The current working directory may not exist when iojs starts up. Don't treat that as an error because it's still possible to do many useful things, like evaluating a command line script or starting a REPL. This commit also fixes an age-old Windows bug where process.argv[0] was not properly expanded, that's why the parallel/test-process-argv-0 test gets an update as well. Fixes: #1184 PR-URL: #1194 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Rod Vagg <rod@vagg.org>
- Loading branch information
1 parent
c15e81a
commit 2c6f79c
Showing
3 changed files
with
35 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var fs = require('fs'); | ||
var spawn = require('child_process').spawn; | ||
|
||
// Fails with EINVAL on SmartOS, EBUSY on Windows. | ||
if (process.platform === 'sunos' || process.platform === 'win32') { | ||
console.log('1..0 # Skipped: cannot rmdir current working directory'); | ||
return; | ||
} | ||
|
||
var dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid; | ||
fs.mkdirSync(dirname); | ||
process.chdir(dirname); | ||
fs.rmdirSync(dirname); | ||
|
||
var proc = spawn(process.execPath, ['-e', '0']); | ||
proc.stdout.pipe(process.stdout); | ||
proc.stderr.pipe(process.stderr); | ||
|
||
proc.once('exit', common.mustCall(function(exitCode, signalCode) { | ||
assert.equal(exitCode, 0); | ||
assert.equal(signalCode, null); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters