MCPcopy Create free account
hub / github.com/chhoumann/quickadd / commandMatchesInstance

Function commandMatchesInstance

scripts/stop-obsidian-e2e-instance.mjs:108–123  ·  view source on GitHub ↗
(command, instancePath)

Source from the content-addressed store, hash-verified

106}
107
108export function commandMatchesInstance(command, instancePath) {
109 const stripped = stripPrivatePrefix(instancePath);
110 const variants = new Set([
111 instancePath,
112 stripped,
113 stripped.replace(/^\//, "/private/"),
114 ]);
115 // Seed only on the Obsidian `--user-data-dir=` flag whose value is THIS
116 // instance's profile dir (with a trailing separator). Scoping to the flag, not
117 // a bare substring, means an unrelated process that merely mentions the path —
118 // a log tail, an editor, a grep — is never pulled into the kill set. The
119 // trailing slash stops a sibling whose id shares this one as a leading string.
120 return [...variants].some((variant) =>
121 command.includes(`--user-data-dir=${variant}/`),
122 );
123}
124
125export function parsePsOutput(stdout) {
126 const processes = [];

Callers 2

collectInstancePidsFunction · 0.85

Calls 1

stripPrivatePrefixFunction · 0.85

Tested by

no test coverage detected