mirror of
https://github.com/rclone/rclone.git
synced 2026-10-09 22:45:26 -04:00
fstest: make test server start fail fast when docker run fails
The start function was run inside an if condition, where bash ignores
errexit, so a failed docker run was not noticed. The script then
printed its connection details anyway and the test spent 100 seconds
trying to connect before failing with a message that hid the real
error.
Run start in a subshell with errexit on and check its status
explicitly so the failure is reported immediately with docker's
error message.
(cherry picked from commit 4cf1da0d4f)
This commit is contained in:
1 parent
fa75e2b178
commit
620ce60d00
1 file changed
+9
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user