summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xservices/bin/services17
1 files changed, 12 insertions, 5 deletions
diff --git a/services/bin/services b/services/bin/services
index e854cbcb..31aca200 100755
--- a/services/bin/services
+++ b/services/bin/services
@@ -25,9 +25,16 @@ fi
exec 3>&1
{
+ set +e
ssh $options $user@$hostname -p $port
-} 2>&1 1>&3 | sed '
- /^Connection to '$hostname' closed/d
- /^Shared connection to '$hostname' closed/d
-'
-exec 3>&-
+ echo "# Exit:$?" >&2
+} 2>&1 1>&3 | {
+ err="`cat`"
+ code=`echo "$err" | sed -n 's/^# Exit:\([0-9]\+\)/\1/p'`
+ echo "$err" | sed '
+ /^Connection to '$hostname' closed/d
+ /^Shared connection to '$hostname' closed/d
+ /^# Exit:/d
+ ' >&2
+ exit $code
+}