MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / stopDaemon

Function stopDaemon

packages/codex-native-api/src/daemon_manager.ts:602–622  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

600}
601
602async function stopDaemon(): Promise<void> {
603 const layout = resolveDaemonLayout();
604 switch (layout.platform) {
605 case 'darwin':
606 assertFileExists(layout.launchdPlistPath, 'launchd plist');
607 await runCommand('launchctl', ['bootout', `gui/${process.getuid?.() ?? 0}`, layout.launchdPlistPath!], { allowFailure: true });
608 return;
609 case 'linux':
610 await runCommand('systemctl', ['--user', 'stop', layout.systemdServiceName!]);
611 return;
612 case 'win32':
613 await runPowerShellScript([
614 '$ErrorActionPreference = "Stop"',
615 `$TaskName = ${toPowerShellString(layout.windowsTaskName ?? WINDOWS_TASK_NAME)}`,
616 'Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue',
617 ].join('\n'));
618 return;
619 default:
620 throw new Error(`Unsupported daemon platform: ${layout.platform}`);
621 }
622}
623
624async function restartDaemon(): Promise<void> {
625 const layout = resolveDaemonLayout();

Callers 1

runDaemonCommandFunction · 0.85

Calls 5

resolveDaemonLayoutFunction · 0.85
assertFileExistsFunction · 0.85
runCommandFunction · 0.85
runPowerShellScriptFunction · 0.85
toPowerShellStringFunction · 0.85

Tested by

no test coverage detected