Skip to content

Commit 7b80bf8

Browse files
committed
chore: forward the exit code returned by the ssh command
also fix logging on error
1 parent ba94023 commit 7b80bf8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/release/bin/deployBackend.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66
# Source the .env file from the parent directory of the script's directory
77
source "$SCRIPT_DIR/../.env"
88

9-
echo "Deploying backend to $BE_HOST with script $BE_SCRIPT_PATH"
9+
echo "Running $BE_SCRIPT_PATH on $BE_HOST with user $BE_USER"
1010

1111
# Connect to SSH and execute remote script
1212
ssh_output=$(ssh "$BE_USER@$BE_HOST" "$BE_SCRIPT_PATH")
1313

14+
# Capture the exit code of the SSH command
15+
exit_code=$?
16+
1417
# Print the output
15-
echo "Remote script output:"
16-
echo "$ssh_output"
18+
echo "$ssh_output"
19+
20+
# Forward the exit code of the remote script
21+
exit $exit_code

packages/release/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const runCommand = (command, force) => {
3030
return output;
3131
} catch (error) {
3232
console.error(`Error executing command ${command}`);
33-
console.error(error);
33+
console.error(error.output.toString());
3434
process.exit(1);
3535
}
3636
}

0 commit comments

Comments
 (0)