Skip to content

Commit 852920b

Browse files
committed
rsync-antora-reference.sh returns rsync status code
Closes gh-28
1 parent 5a57bcc commit 852920b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Diff for: rsync-antora-reference/src/rsync_docs.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ __rsync_docs() {
9494
fi
9595
# Disable filename expansion (globbing)
9696
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
97-
set -f
98-
rsync $rsync_opts -e "ssh -i $ssh_private_key_path" $local_path/ "$ssh_host:$ssh_host_path"
99-
set +f
97+
(
98+
set -f
99+
rsync $rsync_opts -e "ssh -i $ssh_private_key_path" $local_path/ "$ssh_host:$ssh_host_path"
100+
)
100101
}
101102

102103

Diff for: rsync-antora-reference/test/test-rsync_docs.bats

+10
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,14 @@ usage: rsync_docs.sh [OPTION]...
8787
assert_success
8888
refute_regex "$rsync_args" " --include /.htaccess "
8989
unstub rsync
90+
}
91+
92+
@test "when rsync fails script returns non-zero" {
93+
local dir="${BATS_RESOURCE_TEMP_DIR}/no-htaccess"
94+
stub rsync "exit 1"
95+
96+
run rsync_docs.sh --ssh-host HOST --build-ref-name main --ssh-host-path HOST_PATH --ssh-private-key-path PRIVATE_KEY_PATH --local-path "$dir"
97+
98+
assert_failure
99+
unstub rsync
90100
}

0 commit comments

Comments
 (0)