2025-01-07 07:24:20 +01:00
|
|
|
// Flags: --permission --allow-fs-read=*
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2025-04-18 06:07:51 -05:00
|
|
|
const { mustCall, skip, isWindows, isIBMi } = require('../common');
|
2025-01-07 07:24:20 +01:00
|
|
|
const { fail, throws } = require('assert');
|
|
|
|
const { isMainThread } = require('worker_threads');
|
|
|
|
|
|
|
|
if (!isMainThread) {
|
|
|
|
skip('process.execve is not available in Workers');
|
2025-04-18 06:07:51 -05:00
|
|
|
} else if (isWindows || isIBMi) {
|
|
|
|
skip('process.execve is not available in Windows or IBM i');
|
2025-01-07 07:24:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (process.argv[2] === 'replaced') {
|
|
|
|
fail('process.execve should not have been allowed.');
|
|
|
|
} else {
|
|
|
|
throws(mustCall(() => {
|
|
|
|
process.execve(process.execPath, [process.execPath, __filename, 'replaced'], process.env);
|
|
|
|
}), { code: 'ERR_ACCESS_DENIED', permission: 'ChildProcess' });
|
|
|
|
}
|