Skip to content

Commit b1ec186

Browse files
committed
fixup! lib: handle --permission-audit when propagating flags
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
1 parent 9367622 commit b1ec186

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

test/parallel/test-permission-audit-child-process-inherit-flags.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ assert.strictEqual(typeof process.permission.has, 'function');
2323

2424
// Child should inherit --permission-audit and the allow-flags via NODE_OPTIONS
2525
{
26-
const { status, stdout, stderr } = childProcess.spawnSync(process.execPath,
27-
[
28-
'-e',
29-
`
26+
const { status, stdout } = childProcess.spawnSync(process.execPath,
27+
[
28+
'-e',
29+
`
3030
console.log(typeof process.permission);
3131
console.log(process.permission.has("fs.write"));
3232
console.log(process.permission.has("fs.read"));
3333
console.log(process.permission.has("child"));
3434
`,
35-
]
35+
]
3636
);
37-
assert.strictEqual(status, 0, `stderr: ${stderr}`);
37+
assert.strictEqual(status, 0);
3838
const [permType, fsWrite, fsRead, child] = stdout.toString().split('\n');
39-
assert.strictEqual(permType, 'object', 'child should have process.permission defined');
39+
assert.strictEqual(permType, 'object');
4040
assert.strictEqual(fsWrite, 'true');
4141
assert.strictEqual(fsRead, 'true');
4242
assert.strictEqual(child, 'true');
4343
}
4444

4545
// Child spawned with explicit --permission should use its own flags, not inherit parent's
4646
{
47-
const { status, stdout, stderr } = childProcess.spawnSync(
47+
const { status, stdout } = childProcess.spawnSync(
4848
process.execPath,
4949
[
5050
'--permission',
@@ -58,7 +58,7 @@ assert.strictEqual(typeof process.permission.has, 'function');
5858
`,
5959
]
6060
);
61-
assert.strictEqual(status, 0, `stderr: ${stderr}`);
61+
assert.strictEqual(status, 0);
6262
const [permType, fsWrite, fsRead, child] = stdout.toString().split('\n');
6363
assert.strictEqual(permType, 'object');
6464
assert.strictEqual(fsWrite, 'true');
@@ -68,7 +68,7 @@ assert.strictEqual(typeof process.permission.has, 'function');
6868

6969
// Child spawned with explicit --permission-audit should use its own flags
7070
{
71-
const { status, stdout, stderr } = childProcess.spawnSync(
71+
const { status, stdout } = childProcess.spawnSync(
7272
process.execPath,
7373
[
7474
'--permission-audit',
@@ -81,11 +81,10 @@ assert.strictEqual(typeof process.permission.has, 'function');
8181
`,
8282
]
8383
);
84-
assert.strictEqual(status, 0, `stderr: ${stderr}`);
84+
assert.strictEqual(status, 0);
8585
const [permType, fsWrite, fsRead] = stdout.toString().split('\n');
8686
assert.strictEqual(permType, 'object');
8787
assert.strictEqual(fsWrite, 'true');
88-
// fs.read was not allowed in the explicit child flags
8988
assert.strictEqual(fsRead, 'false');
9089
}
9190

0 commit comments

Comments
 (0)