aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2022-07-16 01:21:00 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2022-07-16 01:21:00 -0400
commit5af1b4caa045b6a06f73e5de2be93488c99d240f (patch)
tree92fb9fb4dedc631e7c0c241ed5eb383a2c3c1121
parent683a45cf5d9841770bcf498726ea7b7bacbc7904 (diff)
downloadjupyter_safe_port-5af1b4caa045b6a06f73e5de2be93488c99d240f.tar.gz
Move the ssh sanity check to the block with the ssh call.
-rwxr-xr-xbin/jupyter_safe_port6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/jupyter_safe_port b/bin/jupyter_safe_port
index aa78fb9..8119485 100755
--- a/bin/jupyter_safe_port
+++ b/bin/jupyter_safe_port
@@ -111,13 +111,13 @@ if [[ $(hostname) =~ $server ]] || [[ $server == "localhost"* ]]; then
# Execute the port test script on the local host
port_remote=$(next_tcp_port $port_remote_begin $port_remote_end)
+else
+ # Execute the port test script on the remote host
+ port_remote=$(cat $(which next_tcp_port) | ssh $server "bash -s -- $port_remote_begin $port_remote_end")
if (( $? )); then
echo "error: $server: connection failed" >&2
exit 1
fi
-else
- # Execute the port test script on the remote host
- port_remote=$(cat $(which next_tcp_port) | ssh $server "bash -s -- $port_remote_begin $port_remote_end")
fi
port_local=$(next_tcp_port $port_local_begin)