@radnine/claude-session-daemon 0.9.5 → 0.9.6
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.
- package/package.json +1 -1
- package/src/codex-process.js +11 -7
package/package.json
CHANGED
package/src/codex-process.js
CHANGED
|
@@ -557,19 +557,23 @@ class CodexProcess extends EventEmitter {
|
|
|
557
557
|
|
|
558
558
|
// The child could not be spawned (codex not installed, wrong command). Node
|
|
559
559
|
// throws an uncaught exception for an unhandled 'error' event, which would
|
|
560
|
-
// take the whole daemon down with every other chat on it.
|
|
560
|
+
// take the whole daemon down with every other chat on it. Node also emits
|
|
561
|
+
// 'error' when kill() can't deliver a signal (EPERM); that process is still
|
|
562
|
+
// running, so only a failed spawn, which leaves no pid, marks it stopped.
|
|
561
563
|
_setupError() {
|
|
562
564
|
this._child.on('error', (err) => {
|
|
563
565
|
const message = err && err.code === 'ENOENT'
|
|
564
566
|
? `Codex CLI not found: ${this._codexCommand}`
|
|
565
567
|
: `Codex process error: ${err && err.message}`;
|
|
566
568
|
this._logger.error(message, { sessionId: this._sessionId, error: err && err.message });
|
|
567
|
-
this.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
569
|
+
if (!this._child.pid) {
|
|
570
|
+
this._state = 'stopped';
|
|
571
|
+
const failure = new Error(message);
|
|
572
|
+
for (const [id, pending] of this._pending) {
|
|
573
|
+
clearTimeout(pending.timer);
|
|
574
|
+
pending.reject(failure);
|
|
575
|
+
this._pending.delete(id);
|
|
576
|
+
}
|
|
573
577
|
}
|
|
574
578
|
if (this.listenerCount('error') > 0) this.emit('error', message);
|
|
575
579
|
});
|