From 153b7ed42fb6e5882f2199abff8899841f70a4e4 Mon Sep 17 00:00:00 2001 From: David Matter Date: Mon, 5 Aug 2024 12:39:30 +0200 Subject: [PATCH 1/4] fix(ci): reject exec promise on bad error codes This fixes the canary release workflow which has not run successfully in weeks due to the new exec util that doesn't reject bad exit codes compared to execa. --- scripts/utils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/utils.js b/scripts/utils.js index 2050b05b7cd..e9a63b4f875 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -96,7 +96,16 @@ export async function exec(command, args, options) { const stderr = Buffer.concat(stderrChunks).toString().trim() const stdout = Buffer.concat(stdoutChunks).toString().trim() const result = { ok, code, stderr, stdout } - resolve(result) + + if (ok) { + const result = { ok, code, stderr, stdout } + resolve(result) + } + reject( + new Error( + `Failed to execute command: ${command} ${args.join(' ')}: ${stderr}`, + ), + ) }) }) } From fa5391eea8d755caed3510453f947692442374f6 Mon Sep 17 00:00:00 2001 From: David Matter Date: Mon, 5 Aug 2024 14:49:59 +0200 Subject: [PATCH 2/4] chore: move result to where it's needed --- scripts/utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/utils.js b/scripts/utils.js index e9a63b4f875..d6aa74c681b 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -95,7 +95,6 @@ export async function exec(command, args, options) { const ok = code === 0 const stderr = Buffer.concat(stderrChunks).toString().trim() const stdout = Buffer.concat(stdoutChunks).toString().trim() - const result = { ok, code, stderr, stdout } if (ok) { const result = { ok, code, stderr, stdout } From 1be46fd9e2d22fbe435c0f67d2d70f9dccd1c8f1 Mon Sep 17 00:00:00 2001 From: David Matter Date: Mon, 5 Aug 2024 15:07:53 +0200 Subject: [PATCH 3/4] chore: improve code clarity --- scripts/utils.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/utils.js b/scripts/utils.js index d6aa74c681b..3f210b26e60 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -99,12 +99,13 @@ export async function exec(command, args, options) { if (ok) { const result = { ok, code, stderr, stdout } resolve(result) + } else { + reject( + new Error( + `Failed to execute command: ${command} ${args.join(' ')}: ${stderr}`, + ) + ) } - reject( - new Error( - `Failed to execute command: ${command} ${args.join(' ')}: ${stderr}`, - ), - ) }) }) } From cc68f90849f3afdf84da51eedaacbc89f850bbb0 Mon Sep 17 00:00:00 2001 From: David Matter Date: Mon, 5 Aug 2024 15:10:28 +0200 Subject: [PATCH 4/4] chore: refactor --- scripts/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils.js b/scripts/utils.js index 3f210b26e60..056d95b7b09 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -103,7 +103,7 @@ export async function exec(command, args, options) { reject( new Error( `Failed to execute command: ${command} ${args.join(' ')}: ${stderr}`, - ) + ), ) } })