11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// This tests that the lower bits of mode > 0o777 still works in 41cb0ef41Sopenharmony_ci// process.umask() 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst common = require('../common'); 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciif (!common.isMainThread) 101cb0ef41Sopenharmony_ci common.skip('Setting process.umask is not supported in Workers'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cilet mask; 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciif (common.isWindows) { 151cb0ef41Sopenharmony_ci mask = 0o600; 161cb0ef41Sopenharmony_ci} else { 171cb0ef41Sopenharmony_ci mask = 0o664; 181cb0ef41Sopenharmony_ci} 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciconst maskToIgnore = 0o10000; 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciconst old = process.umask(); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_cifunction test(input, output) { 251cb0ef41Sopenharmony_ci process.umask(input); 261cb0ef41Sopenharmony_ci assert.strictEqual(process.umask(), output); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci process.umask(old); 291cb0ef41Sopenharmony_ci} 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_citest(mask | maskToIgnore, mask); 321cb0ef41Sopenharmony_citest((mask | maskToIgnore).toString(8), mask); 33