Skip to content

Commit 03617cb

Browse files
committed
Fix jq command error handling by redirecting stderr to /dev/null
1 parent 0db4470 commit 03617cb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ssh_wrapper.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ filename="/tmp/$id.json"
55

66
ssh_options=()
77

8-
port=$(jq -r .port $filename)
8+
port=$(jq -r .port $filename 2> /dev/null)
99
if [ -n "$port" ]; then
1010
ssh_options+=(-p $port)
1111
fi
1212

13-
password=$(jq -r .password $filename)
13+
password=$(jq -r .password $filename 2> /dev/null)
1414
if [ -n "$password" ]; then
1515
TMP_PASS=$(mktemp)
1616
echo "$password" > $TMP_PASS
1717
sshpass_command="sshpass -f $TMP_PASS"
1818
fi
1919

20-
key=$(jq -r .key $filename)
20+
key=$(jq -r .key $filename 2> /dev/null)
2121
if [ -n "$key" ]; then
2222
TMP_KEY=$(mktemp)
2323
echo "$key" > $TMP_KEY
@@ -26,6 +26,6 @@ if [ -n "$key" ]; then
2626
fi
2727

2828

29-
destination=$(jq -r .destination $filename)
29+
destination=$(jq -r .destination $filename 2> /dev/null)
3030

3131
exec $sshpass_command ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "${ssh_options[@]}" "$destination"

0 commit comments

Comments
 (0)