From b5583dce7a074f32f8665be8ad220769bc79a569 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 27 Feb 2019 15:22:15 +0200
Subject: [PATCH] Return exit code from monitor.

---
 .bashrc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.bashrc b/.bashrc
index 25ccd4b..1a423d4 100644
--- a/.bashrc
+++ b/.bashrc
@@ -109,12 +109,15 @@ alias detectproxy='lynx http://detectportal.firefox.com/success.txt'
 alias color='less --raw-control-chars -p'
 
 monitor () {
-    if eval "$@"
+    eval "$@"
+    code="$?"
+    if [ "$code" -eq 0 ]
     then
         notify-send "$(basename "${1#__}") has finished."
     else
         notify-send --urgency=critical "$(basename "${1#__}") has failed."
     fi
+    return "$code"
 }
 
 jt () {
-- 
GitLab