mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 04:43:16 +00:00

PR-URL: https://github.com/nodejs/node/pull/47335 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
31 lines
857 B
JavaScript
31 lines
857 B
JavaScript
// Flags: --experimental-permission --allow-fs-read=* --allow-child-process
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfWorker();
|
|
|
|
const assert = require('assert');
|
|
const { spawnSync } = require('child_process');
|
|
|
|
{
|
|
// Relative path as CLI args are NOT supported yet
|
|
const { status, stdout } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-permission',
|
|
'--allow-fs-read', '*',
|
|
'--allow-fs-write', '../fixtures/permission/deny/regular-file.md',
|
|
'-e',
|
|
`
|
|
const path = require("path");
|
|
const absolutePath = path.resolve("../fixtures/permission/deny/regular-file.md");
|
|
console.log(process.permission.has("fs.write", absolutePath));
|
|
`,
|
|
]
|
|
);
|
|
|
|
const [fsWrite] = stdout.toString().split('\n');
|
|
assert.strictEqual(fsWrite, 'false');
|
|
assert.strictEqual(status, 0);
|
|
}
|