summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-15 21:14:04 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-15 23:13:10 -0400
commit0d673eadca425d63c7367372575058324e9ecc91 (patch)
treec6a37ea8ab8075e4ef216803902c86db6bf89b32 /test
parentcac0faec9d6c2ab143debdc3c6fcb5b661e01dd3 (diff)
librechroot: (bugfix) Use the correct exit status if stdout isn't a TTY.v20131015
Because of the work-around for systemd-nspawn's buggy I/O, it was discarding the exit status if stdout wasn't a TTY. My work-around for *this* is to set -o pipefail.
Diffstat (limited to 'test')
-rw-r--r--test/librechroot-test.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh
index 90d0adc..8efba67 100644
--- a/test/librechroot-test.sh
+++ b/test/librechroot-test.sh
@@ -31,6 +31,15 @@ it_cleans_the_local_repo_correctly() {
# TODO: inspect /repo/* more
}
+it_respects_exit_status_if_out_isnt_a_tty() (
+ require network sudo || return 0
+ set -o pipefail
+ libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
+ r=0
+ { testsudo librechroot run exit 3 | cat; } || r=$?
+ [[ $r == 3 ]]
+)
+
it_displays_help_as_normal_user() {
rm -rf "$XDG_CONFIG_HOME"
LANG=C librechroot help >$tmpdir/stdout 2>$tmpdir/stderr