0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-process-umask-mask.js
cjihrig f6cd4e3e59
process: allow reading umask in workers
Refs: https://github.com/nodejs/node/issues/25448
PR-URL: https://github.com/nodejs/node/pull/25526
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-01-17 16:32:21 -05:00

33 lines
615 B
JavaScript

'use strict';
// This tests that the lower bits of mode > 0o777 still works in
// process.umask()
const common = require('../common');
const assert = require('assert');
if (!common.isMainThread)
common.skip('Setting process.umask is not supported in Workers');
let mask;
if (common.isWindows) {
mask = 0o600;
} else {
mask = 0o664;
}
const maskToIgnore = 0o10000;
const old = process.umask();
function test(input, output) {
process.umask(input);
assert.strictEqual(process.umask(), output);
process.umask(old);
}
test(mask | maskToIgnore, mask);
test((mask | maskToIgnore).toString(8), mask);