2015-08-12 02:25:49 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
2017-07-01 01:29:09 +02:00
|
|
|
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
2017-07-16 09:07:33 +02:00
|
|
|
if (common.isSunOS || common.isWindows || common.isAIX)
|
2017-07-01 01:29:09 +02:00
|
|
|
common.skip('cannot rmdir current working directory');
|
|
|
|
|
2015-08-12 02:25:49 +02:00
|
|
|
const assert = require('assert');
|
|
|
|
const fs = require('fs');
|
|
|
|
const spawn = require('child_process').spawn;
|
2017-07-18 00:33:46 +02:00
|
|
|
const fixtures = require('../common/fixtures');
|
2017-12-25 07:38:11 +01:00
|
|
|
const tmpdir = require('../common/tmpdir');
|
2015-08-12 02:25:49 +02:00
|
|
|
|
2017-12-25 07:38:11 +01:00
|
|
|
const dirname = `${tmpdir.path}/cwd-does-not-exist-${process.pid}`;
|
2017-07-18 00:33:46 +02:00
|
|
|
const abspathFile = fixtures.path('a.js');
|
2017-12-25 07:38:11 +01:00
|
|
|
tmpdir.refresh();
|
2015-08-12 02:25:49 +02:00
|
|
|
fs.mkdirSync(dirname);
|
|
|
|
process.chdir(dirname);
|
|
|
|
fs.rmdirSync(dirname);
|
|
|
|
|
|
|
|
|
|
|
|
const proc = spawn(process.execPath, ['-r', abspathFile, '-e', '0']);
|
|
|
|
proc.stdout.pipe(process.stdout);
|
|
|
|
proc.stderr.pipe(process.stderr);
|
|
|
|
|
|
|
|
proc.once('exit', common.mustCall(function(exitCode, signalCode) {
|
|
|
|
assert.strictEqual(exitCode, 0);
|
|
|
|
assert.strictEqual(signalCode, null);
|
|
|
|
}));
|