about summary refs log tree commit diff
path: root/xchroot
diff options
context:
space:
mode:
Diffstat (limited to 'xchroot')
-rwxr-xr-xxchroot7
1 files changed, 5 insertions, 2 deletions
diff --git a/xchroot b/xchroot
index bca68d8..b86819a 100755
--- a/xchroot
+++ b/xchroot
@@ -41,8 +41,11 @@ fi
 
 printf "\033[1m=> Entering chroot $CHROOT\033[m\n"
 export PS1="[xchroot $CHROOT] $PS1"
-if chroot "$CHROOT" ${@:-$INNER_SHELL}; then
+chroot "$CHROOT" ${@:-$INNER_SHELL}
+STATUS=$?
+if [ $STATUS -ne 0 ]; then
 	printf "\033[1m=> Exited chroot $CHROOT\033[m\n"
 else
-	printf "\033[1m=> Exited chroot $CHROOT with status $?\033[m\n"
+	printf "\033[1m=> Exited chroot $CHROOT with status $STATUS\033[m\n"
 fi
+exit $STATUS