mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
bf6ce47259
Move tmpdir functionality to its own module (common/tmpdir). PR-URL: https://github.com/nodejs/node/pull/17856 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
29 lines
916 B
JavaScript
29 lines
916 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
// 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');
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const spawn = require('child_process').spawn;
|
|
const fixtures = require('../common/fixtures');
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
const dirname = `${tmpdir.path}/cwd-does-not-exist-${process.pid}`;
|
|
const abspathFile = fixtures.path('a.js');
|
|
tmpdir.refresh();
|
|
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);
|
|
}));
|