From aae472800db99e6f947e52a4c616ba5602934735 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 15 May 2024 15:14:29 -0700 Subject: [PATCH] fix(chromeos): Fix node-ssh exit code interpretation (#92) 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backends/chromeos/chromeos-utils.js b/backends/chromeos/chromeos-utils.js index eba6ade..f1adc84 100644 --- a/backends/chromeos/chromeos-utils.js +++ b/backends/chromeos/chromeos-utils.js @@ -211,8 +211,9 @@ 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. + 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}`);