summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYour Name <you@example.com>2013-02-08 20:17:49 +0000
committerYour Name <you@example.com>2013-02-08 20:17:49 +0000
commit4d72f073e0274949e85472b6e528be8209025887 (patch)
tree7939dc7f3a50d3729a799cc63ab215cf5184415b
parent94c068e63b079a3ab8c16ad2af93978e70db4acc (diff)
parentc5953301c721096e97ce7e83037f0da85ee4eaa7 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
-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
+}