summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/chroot-tools/librechroot2
-rw-r--r--test/librechroot-test.sh9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 81163b0..4941b95 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -181,7 +181,7 @@ arch-nspawn() {
if [[ -t 1 ]]; then
cmd=("$@")
else
- cmd=(bash --noprofile --norc -c "$(printf '%q ' "$@") |&cat")
+ cmd=(bash --noprofile --norc -c "set -o pipefail; $(printf '%q ' "$@") |&cat")
fi
set +u # if an array is empty, it counts as unbound
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