(dir, allowExecute)
| 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)) { |
no test coverage detected
searching dependent graphs…