@opencode-cockpit/daemon 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,13 +62,31 @@ export class ProcessRegistry {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* When a pid was started, used only to tell a reused pid from the one we registered.
|
|
68
|
+
*
|
|
69
|
+
* Best effort on purpose. It is reached from `add`, on the path that starts a shell, so anything
|
|
70
|
+
* thrown here fails the whole command the user asked for — and a daemon inherits whatever PATH the
|
|
71
|
+
* editor that spawned it had, which more than once has not included `ps`:
|
|
72
|
+
* `ENOENT: no such file or directory, posix_spawn 'ps'` turned every shell_start into an error.
|
|
73
|
+
* Look where `ps` actually lives before trusting PATH, and treat not finding it as "unknown".
|
|
74
|
+
*/
|
|
75
|
+
const PS = ["/bin/ps", "/usr/bin/ps", "ps"];
|
|
65
76
|
export function processStartTime(pid) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
for (const ps of PS) {
|
|
78
|
+
try {
|
|
79
|
+
const result = Bun.spawnSync([ps, "-o", "lstart=", "-p", String(pid)], {
|
|
80
|
+
stdout: "pipe",
|
|
81
|
+
stderr: "ignore"
|
|
82
|
+
});
|
|
83
|
+
const text = result.stdout.toString().trim();
|
|
84
|
+
if (result.exitCode === 0 && text) return text;
|
|
85
|
+
} catch {
|
|
86
|
+
// not at this path; try the next
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
72
90
|
}
|
|
73
91
|
function signalGroup(pid, signal) {
|
|
74
92
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode-cockpit/daemon",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "cockpitd: the process host behind opencode-cockpit (PTY shells, clean logs, wait conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@opencode-cockpit/protocol": "0.3.
|
|
44
|
+
"@opencode-cockpit/protocol": "0.3.2",
|
|
45
45
|
"@xterm/headless": "6.0.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|