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

Function restartDaemon

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

Source from the content-addressed store, hash-verified

622}
623
624async function restartDaemon(): Promise<void> {
625 const layout = resolveDaemonLayout();
626 switch (layout.platform) {
627 case 'darwin':
628 assertFileExists(layout.launchdPlistPath, 'launchd plist');
629 await runCommand('launchctl', ['bootout', `gui/${process.getuid?.() ?? 0}`, layout.launchdPlistPath!], { allowFailure: true });
630 await runCommand('launchctl', ['bootstrap', `gui/${process.getuid?.() ?? 0}`, layout.launchdPlistPath!]);
631 await runCommand('launchctl', ['enable', `gui/${process.getuid?.() ?? 0}/${layout.launchdLabel!}`]);
632 await runCommand('launchctl', ['kickstart', '-k', `gui/${process.getuid?.() ?? 0}/${layout.launchdLabel!}`]);
633 return;
634 case 'linux':
635 await runCommand('systemctl', ['--user', 'restart', layout.systemdServiceName!]);
636 return;
637 case 'win32':
638 await runPowerShellScript([
639 '$ErrorActionPreference = "Stop"',
640 `$TaskName = ${toPowerShellString(layout.windowsTaskName ?? WINDOWS_TASK_NAME)}`,
641 'Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue',
642 'Start-ScheduledTask -TaskName $TaskName',
643 ].join('\n'));
644 return;
645 default:
646 throw new Error(`Unsupported daemon platform: ${layout.platform}`);
647 }
648}
649
650async function statusDaemon(): Promise<void> {
651 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