Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fstest: make test server start fail fast when docker run fails

Nick Craig-Wood4cf1da0d4f90
diff --git a/fstest/testserver/init.d/run.bash b/fstest/testserver/init.d/run.bash
index 4d59569c7..68393200b 100644
--- a/fstest/testserver/init.d/run.bash
+++ b/fstest/testserver/init.d/run.bash
@@ -49,7 +49,15 @@ case "${1:-}" in
if _is_running; then
stop || true
fi
- if ! out="$(start)"; then
+ # Run start in a subshell with errexit on so a failing command
+ # (eg docker run) aborts it. The subshell's status is only
+ # honoured if it is not part of an if/|| condition, as bash
+ # ignores errexit inside those, so capture it separately.
+ set +e
+ out="$(set -e; start)"
+ start_rc=$?
+ set -e
+ if (( start_rc != 0 )); then
echo "failed to start" >&2
exit 1
fi