Skip to content

Commit 212e528

Browse files
committed
Add URL scheme to kill tasks stikjit://kill-process?pid=1234
1 parent 798b036 commit 212e528

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

StikJIT/Views/HomeView.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,23 @@ struct HomeView: View {
287287
} else {
288288
pendingJITEnableConfiguration = config
289289
}
290+
case "kill-process":
291+
if let pidStr = components?.queryItems?.first(where: { $0.name == "pid" })?.value, let pid = Int(pidStr) {
292+
pubHeartBeat = false
293+
startHeartbeatInBackground(showErrorUI: false)
294+
DispatchQueue.global(qos: .userInitiated).async {
295+
sleep(1)
296+
var error: NSError?
297+
let success = JITEnableContext.shared.killProcess(withPID: Int32(pid), error: &error)
298+
DispatchQueue.main.async {
299+
if success {
300+
LogManager.shared.addInfoLog("Killed process \(pid) via URL scheme")
301+
} else {
302+
LogManager.shared.addErrorLog("Failed to kill process \(pid): \(error?.localizedDescription ?? "Unknown error")")
303+
}
304+
}
305+
}
306+
}
290307
case "launch-app":
291308
if let bundleId = components?.queryItems?.first(where: { $0.name == "bundle-id" })?.value {
292309
HapticFeedbackHelper.trigger()

0 commit comments

Comments
 (0)