From 49cccd70679614846d106ad4cf210ce0f2a017b8 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Thu, 10 Feb 2022 14:04:18 -0700 Subject: [PATCH] fix: add both stdout and stderr to getExitCodeError --- src/execCmd.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/execCmd.ts b/src/execCmd.ts index b3988cac..cf9c3423 100644 --- a/src/execCmd.ts +++ b/src/execCmd.ts @@ -109,8 +109,10 @@ const addJsonOutput = (cmd: string, result: T): T => }; const getExitCodeError = (cmd: string, expectedCode: number, output: ShellString) => { - const io = cmd.includes('--json') ? output.stdout : output.stderr; - return Error(`Unexpected exit code for command: ${cmd}. Expected: ${expectedCode} Actual: ${output.code}\n${io}`); + const errorDetails = `\nstdout=${output.stdout}\nstderr=${output.stderr}`; + return Error( + `Unexpected exit code for command: ${cmd}. Expected: ${expectedCode} Actual: ${output.code}${errorDetails}` + ); }; /**