11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ci// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. 41cb0ef41Sopenharmony_ciif (common.isSunOS || common.isWindows || common.isAIX || common.isIBMi) 51cb0ef41Sopenharmony_ci common.skip('cannot rmdir current working directory'); 61cb0ef41Sopenharmony_ciif (!common.isMainThread) 71cb0ef41Sopenharmony_ci common.skip('process.chdir is not available in Workers'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst assert = require('assert'); 101cb0ef41Sopenharmony_ciconst fs = require('fs'); 111cb0ef41Sopenharmony_ciconst spawn = require('child_process').spawn; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciconst dirname = `${tmpdir.path}/cwd-does-not-exist-${process.pid}`; 161cb0ef41Sopenharmony_citmpdir.refresh(); 171cb0ef41Sopenharmony_cifs.mkdirSync(dirname); 181cb0ef41Sopenharmony_ciprocess.chdir(dirname); 191cb0ef41Sopenharmony_cifs.rmdirSync(dirname); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ciconst proc = spawn(process.execPath, ['-e', '0']); 221cb0ef41Sopenharmony_ciproc.stdout.pipe(process.stdout); 231cb0ef41Sopenharmony_ciproc.stderr.pipe(process.stderr); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ciproc.once('exit', common.mustCall(function(exitCode, signalCode) { 261cb0ef41Sopenharmony_ci assert.strictEqual(exitCode, 0); 271cb0ef41Sopenharmony_ci assert.strictEqual(signalCode, null); 281cb0ef41Sopenharmony_ci})); 29