MCPcopy
hub / github.com/KeygraphHQ/shannon / blockSudo

Function blockSudo

apps/cli/src/index.ts:28–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26const __dirname = path.dirname(fileURLToPath(import.meta.url));
27
28function 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
47function getVersion(): string {
48 try {

Callers 1

index.tsFile · 0.85

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected