()
| 537 | } |
| 538 | |
| 539 | function canCreateSymLink() { |
| 540 | // On Windows, creating symlinks requires admin privileges. |
| 541 | // We'll only try to run symlink test if we have enough privileges. |
| 542 | // On other platforms, creating symlinks shouldn't need admin privileges |
| 543 | if (isWindows) { |
| 544 | // whoami.exe needs to be the one from System32 |
| 545 | // If unix tools are in the path, they can shadow the one we want, |
| 546 | // so use the full path while executing whoami |
| 547 | const whoamiPath = path.join(process.env.SystemRoot, |
| 548 | 'System32', 'whoami.exe'); |
| 549 | |
| 550 | try { |
| 551 | const { execSync } = require('child_process'); |
| 552 | const output = execSync(`${whoamiPath} /priv`, { timeout: 1000 }); |
| 553 | return output.includes('SeCreateSymbolicLinkPrivilege'); |
| 554 | } catch { |
| 555 | return false; |
| 556 | } |
| 557 | } |
| 558 | // On non-Windows platforms, this always returns `true` |
| 559 | return true; |
| 560 | } |
| 561 | |
| 562 | function mustNotCall(msg) { |
| 563 | const callSite = getCallSites()[1]; |
no test coverage detected
searching dependent graphs…