mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 17:10:40 +00:00

Use the common.isWindows, common.isFreeBSD and common.isSunOS where possible. Add common.isOSX and common.isLinux. Fix `test-fs-read-file-sync-hostname` as in its current form was not being run anywhere. PR-URL: https://github.com/nodejs/node/pull/7845 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
29 lines
847 B
JavaScript
29 lines
847 B
JavaScript
'use strict';
|
|
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, EBUSY on AIX.
|
|
if (common.isSunOS || common.isWindows || common.isAix) {
|
|
common.skip('cannot rmdir current working directory');
|
|
return;
|
|
}
|
|
|
|
var dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
|
|
common.refreshTmpDir();
|
|
fs.mkdirSync(dirname);
|
|
process.chdir(dirname);
|
|
fs.rmdirSync(dirname);
|
|
|
|
var proc = spawn(process.execPath, ['--interactive']);
|
|
proc.stdout.pipe(process.stdout);
|
|
proc.stderr.pipe(process.stderr);
|
|
proc.stdin.write('require("path");\n');
|
|
proc.stdin.write('process.exit(42);\n');
|
|
|
|
proc.once('exit', common.mustCall(function(exitCode, signalCode) {
|
|
assert.equal(exitCode, 42);
|
|
assert.equal(signalCode, null);
|
|
}));
|