fix(imessage): preserve signal info in RPC close handler

The original code intended to report signal information when the imsg
RPC process was killed (evidenced by the `signal ?` ternary on line 95).
However, the condition `code !== 0 && code !== null` prevented this from
ever happening.

When a process is killed by a signal (e.g., SIGTERM):
- code is null
- signal is "SIGTERM"

The old condition evaluated as: (null !== 0) && (null !== null) = false
This routed signal kills to the else branch, losing the signal info.

Changed to `code !== 0 || signal` so signal-killed processes now
correctly report "imsg rpc exited (signal SIGTERM)" instead of the
generic "imsg rpc closed" message.
This commit is contained in:
Sal Jim 2026-01-27 14:26:57 +03:00
parent f4004054ab
commit 18a0a8ee3d

View File

@ -91,7 +91,7 @@ export class IMessageRpcClient {
});
child.on("close", (code, signal) => {
if (code !== 0 && code !== null) {
if (code !== 0 || signal) {
const reason = signal ? `signal ${signal}` : `code ${code}`;
this.failAll(new Error(`imsg rpc exited (${reason})`));
} else {