From 1a0b858368ca7b0c28df62d74981e3f5b0eac794 Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Wed, 3 Jul 2024 09:57:03 -0400 Subject: [PATCH 1/2] Handle nonzero exit codes as errors. --- src/execShell.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/execShell.ts b/src/execShell.ts index 2f7e2d5..1ae63ea 100644 --- a/src/execShell.ts +++ b/src/execShell.ts @@ -19,6 +19,9 @@ export function execShellSync( if (result.error) { throw result.error; } + if (result.status !== 0) { + throw new Error(`${file} failed with status ${result.status}.`); + } return result.stdout; } else { return execFileSync(file, args, options); From 5316934d773849f741e86b94f67507e32fdea6fc Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Wed, 3 Jul 2024 10:00:49 -0400 Subject: [PATCH 2/2] Renamed to exit code --- src/execShell.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execShell.ts b/src/execShell.ts index 1ae63ea..3ae8d27 100644 --- a/src/execShell.ts +++ b/src/execShell.ts @@ -20,7 +20,7 @@ export function execShellSync( throw result.error; } if (result.status !== 0) { - throw new Error(`${file} failed with status ${result.status}.`); + throw new Error(`${file} failed with exit code ${result.status}.`); } return result.stdout; } else {