From 6914a1b193a5e6d8f399b5d4d108878918ecbcc6 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 15 May 2024 21:23:05 +0000 Subject: [PATCH 1/2] fix(chromeos): Fix node-ssh exit code interpretation Since upgrading node-ssh, we sometimes get an exit code of 0, other times an exit code of null. This makes the tool more flexible in interpreting those codes. --- backends/chromeos/chromeos-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/chromeos/chromeos-utils.js b/backends/chromeos/chromeos-utils.js index 9f116e3..8a2e138 100644 --- a/backends/chromeos/chromeos-utils.js +++ b/backends/chromeos/chromeos-utils.js @@ -203,8 +203,8 @@ async function executeRemoteCommand(log, ssh, argv) { const output = await ssh.exec(executable, args, options); - // output.code == 0 means success. - if (output.code != 0) { + // output.code == 0 or output.code == null means success. + if (output.code != 0 && output.code != null) { log.error(`Remote command ${argv.join(' ')} ` + `failed with exit code ${output.code} ` + `and full output: ${output.stdout} ${output.stderr}`); From 068c7bf1142a9453285d550f28bd8e0e453f94ba Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 15 May 2024 22:07:22 +0000 Subject: [PATCH 2/2] Address feedback --- backends/chromeos/chromeos-utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backends/chromeos/chromeos-utils.js b/backends/chromeos/chromeos-utils.js index 8a2e138..f924ae1 100644 --- a/backends/chromeos/chromeos-utils.js +++ b/backends/chromeos/chromeos-utils.js @@ -204,7 +204,8 @@ async function executeRemoteCommand(log, ssh, argv) { const output = await ssh.exec(executable, args, options); // output.code == 0 or output.code == null means success. - if (output.code != 0 && output.code != null) { + const success = output.code == 0 || output.code == null; + if (!success) { log.error(`Remote command ${argv.join(' ')} ` + `failed with exit code ${output.code} ` + `and full output: ${output.stdout} ${output.stderr}`);