|
|
@@ -82,8 +82,6 @@ export class ManagedClaudeCodeProcess implements SpawnedProcess {
|
|
|
readonly stdin
|
|
|
readonly stdout
|
|
|
private readonly events = new EventEmitter()
|
|
|
- private exitCodeValue: number | null = null
|
|
|
- private signalCodeValue: NodeJS.Signals | null = null
|
|
|
private outcomeValue: SubprocessOutcome | undefined
|
|
|
private killRequested = false
|
|
|
|
|
|
@@ -101,8 +99,6 @@ export class ManagedClaudeCodeProcess implements SpawnedProcess {
|
|
|
void child.done.then(
|
|
|
(outcome) => {
|
|
|
this.outcomeValue = outcome
|
|
|
- this.exitCodeValue = outcome.exitCode
|
|
|
- this.signalCodeValue = outcome.signal
|
|
|
this.events.emit('exit', outcome.exitCode, outcome.signal)
|
|
|
},
|
|
|
(error: unknown) => {
|
|
|
@@ -118,12 +114,12 @@ export class ManagedClaudeCodeProcess implements SpawnedProcess {
|
|
|
|
|
|
/** Direct-child exit code, or null while running or after signal exit. */
|
|
|
get exitCode(): number | null {
|
|
|
- return this.exitCodeValue
|
|
|
+ return this.outcomeValue?.exitCode ?? null
|
|
|
}
|
|
|
|
|
|
/** Direct-child terminating signal, if any. */
|
|
|
get signalCode(): NodeJS.Signals | null {
|
|
|
- return this.signalCodeValue
|
|
|
+ return this.outcomeValue?.signal ?? null
|
|
|
}
|
|
|
|
|
|
/** Exact managed-process outcome after exit, or undefined while running. */
|
|
|
@@ -139,8 +135,7 @@ export class ManagedClaudeCodeProcess implements SpawnedProcess {
|
|
|
kill(_signal: NodeJS.Signals): boolean {
|
|
|
if (
|
|
|
this.killRequested
|
|
|
- || this.exitCodeValue !== null
|
|
|
- || this.signalCodeValue !== null
|
|
|
+ || this.outcomeValue !== undefined
|
|
|
) {
|
|
|
return false
|
|
|
}
|