mirror of
https://github.com/phantomptr/ps5upload.git
synced 2026-10-19 02:20:02 -05:00
kill-stale-client did `pkill -f ps5upload-engine`, which SIGTERMed every engine on the machine — a standalone one on another port died 70 minutes into a package build. It now stops only an engine listening on 19113 (an engine whose app is gone exits by itself). The decision is a small pure module with node:test cases, which scripts:check now runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
889 B
JavaScript
22 lines
889 B
JavaScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import { staleEnginePids } from "./stale-client-lib.mjs";
|
|
|
|
test("only the engine holding the app's port is stale", () => {
|
|
const listeners = [
|
|
{ pid: 10, command: "/Users/me/Library/Application Support/com.phantomptr.ps5upload/engine/ps5upload-engine" },
|
|
{ pid: 11, command: "/usr/bin/python3 -m http.server 19113" },
|
|
];
|
|
assert.deepEqual(staleEnginePids(listeners), [10]);
|
|
});
|
|
|
|
test("an engine elsewhere — a conversion on another port — is never in the list to kill", () => {
|
|
// The caller passes only what listens on the app's port; nothing else can come back.
|
|
assert.deepEqual(staleEnginePids([]), []);
|
|
});
|
|
|
|
test("a name that merely contains the words is not the engine", () => {
|
|
assert.deepEqual(staleEnginePids([{ pid: 12, command: "vim notes-about-ps5upload-engine.txt" }]), []);
|
|
});
|