Add /restart WhatsApp command to restart warelay
This commit is contained in:
1 parent
8f99b13305
commit
0824873ffb
3 files changed
+34
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { spawn } from "node:child_process";
|
||||
|
||||
const DEFAULT_LAUNCHD_LABEL = "com.steipete.warelay";
|
||||
|
||||
export function triggerWarelayRestart(): void {
|
||||
const label = process.env.WARELAY_LAUNCHD_LABEL || DEFAULT_LAUNCHD_LABEL;
|
||||
const uid = typeof process.getuid === "function" ? process.getuid() : undefined;
|
||||
const target = uid !== undefined ? `gui/${uid}/${label}` : label;
|
||||
const child = spawn("launchctl", ["kickstart", "-k", target], {
|
||||
detached: true,
|
||||
stdio: "ignore",
|
||||
});
|
||||
child.unref();
|
||||
}
|
||||
Reference in new issue
Block a user