| 26 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 27 | |
| 28 | function blockSudo(): void { |
| 29 | const isSudo = !!process.env.SUDO_USER; |
| 30 | const isRoot = process.geteuid?.() === 0; |
| 31 | if (!isSudo && !isRoot) return; |
| 32 | |
| 33 | if (isSudo) { |
| 34 | console.error('ERROR: Shannon must not be run with sudo.'); |
| 35 | console.error('Re-run this command as your normal user.'); |
| 36 | } else { |
| 37 | console.error('ERROR: Shannon must not be run as the root user.'); |
| 38 | console.error('Switch to a regular user account and re-run this command.'); |
| 39 | } |
| 40 | if (process.platform === 'linux') { |
| 41 | console.error('Configure Docker to run without sudo first:'); |
| 42 | console.error('https://docs.docker.com/engine/install/linux-postinstall'); |
| 43 | } |
| 44 | process.exit(1); |
| 45 | } |
| 46 | |
| 47 | function getVersion(): string { |
| 48 | try { |