From fa1b357fd6fc50a68a6ccf6225e795f872e4bded Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 24 Nov 2025 16:11:06 +0100 Subject: [PATCH] Log stderr and timeout info for auto-reply commands --- src/index.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index aa9b0e509..36e4ebf94 100644 --- a/src/index.ts +++ b/src/index.ts @@ -400,12 +400,19 @@ async function getReplyFromConfig( logVerbose(`Resolved command argv: ${finalArgv.join(" ")}`); const started = Date.now(); try { - const { stdout } = await execFileAsync(finalArgv[0], finalArgv.slice(1), { - maxBuffer: 1024 * 1024, - timeout: timeoutMs, - killSignal: "SIGKILL", - }); + const { stdout, stderr } = await execFileAsync( + finalArgv[0], + finalArgv.slice(1), + { + maxBuffer: 1024 * 1024, + timeout: timeoutMs, + killSignal: "SIGKILL", + }, + ); const trimmed = stdout.trim(); + if (stderr?.trim()) { + logVerbose(`Command auto-reply stderr: ${stderr.trim()}`); + } logVerbose( `Command auto-reply stdout (trimmed): ${trimmed || ""}`, ); @@ -415,6 +422,13 @@ async function getReplyFromConfig( const elapsed = Date.now() - started; const anyErr = err as { killed?: boolean; signal?: string }; const timeoutHit = anyErr.killed === true || anyErr.signal === "SIGKILL"; + const errorObj = err as { + stdout?: string; + stderr?: string; + }; + if (errorObj.stderr?.trim()) { + logVerbose(`Command auto-reply stderr: ${errorObj.stderr.trim()}`); + } if (timeoutHit) { console.error( `Command auto-reply timed out after ${elapsed}ms (limit ${timeoutMs}ms)`,