2025-12-24 22:16:06 +01:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
enum LaunchdManager {
|
|
|
|
|
private static func runLaunchctl(_ args: [String]) {
|
|
|
|
|
let process = Process()
|
|
|
|
|
process.launchPath = "/bin/launchctl"
|
|
|
|
|
process.arguments = args
|
|
|
|
|
try? process.run()
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 14:32:47 +00:00
|
|
|
static func startClawdbot() {
|
2025-12-24 22:16:06 +01:00
|
|
|
let userTarget = "gui/\(getuid())/\(launchdLabel)"
|
|
|
|
|
self.runLaunchctl(["kickstart", "-k", userTarget])
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 14:32:47 +00:00
|
|
|
static func stopClawdbot() {
|
2025-12-24 22:16:06 +01:00
|
|
|
let userTarget = "gui/\(getuid())/\(launchdLabel)"
|
|
|
|
|
self.runLaunchctl(["stop", userTarget])
|
|
|
|
|
}
|
|
|
|
|
}
|