PR-URL: https://github.com/nodejs/node/pull/62020 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
22 lines
543 B
JavaScript
22 lines
543 B
JavaScript
// Flags: --permission --allow-worker --allow-fs-read=*
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { isMainThread, Worker } = require('worker_threads');
|
|
|
|
if (!isMainThread) {
|
|
return;
|
|
}
|
|
|
|
// Guarantee the initial state
|
|
{
|
|
assert.ok(process.permission.has('worker'));
|
|
}
|
|
|
|
// When a permission is set by cli, the process shouldn't be able
|
|
// to spawn unless --allow-worker is sent
|
|
{
|
|
// doesNotThrow
|
|
new Worker(__filename).on('exit', common.mustCall((code) => assert.strictEqual(code, 0)));
|
|
}
|