Source

hgd / hd

Diff from to
 #!/usr/bin/env bash
 
+set -e
+
 DIR="`pwd`"
 CMD=""
 
 for ARG in "$@"
 do
-    CMD="$CMD"$'\n'"$ARG"
+    CMD="$CMD"$'\r\n'"$ARG"
 done
 
-PAYLOAD="$DIR"$'\n'"$CMD"$'\n'"HGDAEMONARGSDONE"$'\n'
+PAYLOAD="$DIR"$'\r\n'"$CMD"$'\r\n'"HGDAEMONARGSDONE"$'\r\n'
 
-echo "$PAYLOAD" | netcat localhost 8029
+echo "$PAYLOAD" | netcat localhost 8029 || { echo "abort: hgd server not running!" >&2; exit 1; }
 
 exit