MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / stopAgentDevice

Function stopAgentDevice

scripts/bench/agent-control-benchmark.mjs:993–1012  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

991}
992
993function stopAgentDevice() {
994 const pids = agentDevicePids();
995 for (const pid of pids) {
996 try {
997 process.kill(pid, "SIGTERM");
998 } catch {
999 // Process may already be gone.
1000 }
1001 }
1002 if (pids.length > 0) {
1003 spawnSync("sleep", ["0.5"]);
1004 }
1005 for (const pid of agentDevicePids()) {
1006 try {
1007 process.kill(pid, "SIGKILL");
1008 } catch {
1009 // Process may already be gone.
1010 }
1011 }
1012}
1013
1014function agentDevicePids() {
1015 const ps = spawnSync("ps", ["-axo", "pid=,command="], {

Callers 1

benchmarkAgentDeviceFunction · 0.85

Calls 1

agentDevicePidsFunction · 0.85

Tested by

no test coverage detected