[syslog] wait using ssh, instead of netaddr
This is a simpler solution and also involves (in the future) less log spam.
Test: local, checked that ctrl+c also works as desired.
Change-Id: I88a674385c368ca498fb890ed0dec8c649b68ded
diff --git a/devshell/syslog b/devshell/syslog
index e62271d..7fe3f6e 100755
--- a/devshell/syslog
+++ b/devshell/syslog
@@ -16,20 +16,14 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
function listen {
- trap "exit 0" INT
while true; do
- addr="$(get-fuchsia-device-addr --nowait --timeout=1000)"
- if [[ -n "${addr}" ]]; then
- echo "Connecting to device (${addr})..."
- (fx-command-exec ssh "${addr}" log_listener "$@" || true)
- if [[ $? -eq 0 ]]; then
- break
- fi
- fi
+ fx-command-run wait || return
+ fx-command-run shell log_listener "$@"
+ echo "Connection lost, reconnecting..."
done
}
-echo "Looking for device"
+echo "Connecting..."
if [[ $# > 0 && "$1" = "--raw" ]]; then
shift
listen "$@"