blob: 228d1ea5607fc1b9d14e1fb8ddca7798e7550260 [file] [edit]
// 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)));
}