MCPcopy Index your code
hub / github.com/nodejs/node / makeDirectoryReadOnly

Function makeDirectoryReadOnly

test/parallel/test-fs-rm.js:492–509  ·  view source on GitHub ↗
(dir, allowExecute)

Source from the content-addressed store, hash-verified

490 // This test should not be run as `root`
491 if (!common.isIBMi && (common.isWindows || process.getuid() !== 0)) {
492 function makeDirectoryReadOnly(dir, allowExecute) {
493 let accessErrorCode = 'EACCES';
494 if (common.isMacOS && allowExecute) {
495 accessErrorCode = 'ENOTEMPTY';
496 }
497 if (common.isWindows) {
498 accessErrorCode = 'EPERM';
499 const permissions = ['DE', 'DC'];
500 if (!allowExecute) {
501 permissions.push('X');
502 }
503 execSync(`icacls ${dir} /deny "everyone:(OI)(CI)(${permissions.join(',')})"`);
504 } else {
505 const mode = allowExecute ? 0o555 : 0o444;
506 fs.chmodSync(dir, mode);
507 }
508 return accessErrorCode;
509 }
510
511 function makeDirectoryWritable(dir) {
512 if (fs.existsSync(dir)) {

Callers 1

test-fs-rm.jsFile · 0.70

Calls 4

execSyncFunction · 0.85
pushMethod · 0.45
joinMethod · 0.45
chmodSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…