From d556a7f64915080d20ed868133cce73e17687c8d Mon Sep 17 00:00:00 2001 From: Jeff Fisher Date: Mon, 6 Feb 2023 16:45:32 -0600 Subject: [PATCH] Fix issue with `allowNonzeroExitCode` The behavior for rejecting on a non-zero exit code was flipped, resulting in applications which exited abnormally resolving the promise successfully. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7ad8122..72d1cdc 100644 --- a/index.js +++ b/index.js @@ -209,7 +209,7 @@ const baseOpen = async options => { subprocess.once('error', reject); subprocess.once('close', exitCode => { - if (options.allowNonzeroExitCode && exitCode > 0) { + if (!options.allowNonzeroExitCode && exitCode > 0) { reject(new Error(`Exited with code ${exitCode}`)); return; }