Skip to content

Commit

Permalink
Merge #322: run-tests: Fix interrupt handling for --copy-src
Browse files Browse the repository at this point in the history
8e3feec run-tests: fix interrupt handling for --copy-src (Erik Arvstedt)

Pull request description:

ACKs for top commit:
  nixbitcoin:
    ACK 8e3feec

Tree-SHA512: ec4916facedb1f5988dccd0e80e08fcf1788a8425320676e6c48350aa69f29d302bb102408c52c748ac5a794735c0c00d7a95dbea91d735add40b5690817d272
  • Loading branch information
jonasnick committed Feb 14, 2021
2 parents 14f81b4 + 8e3feec commit eddc48e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/lib/copy-src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

tmp=$(mktemp -d '/tmp/nix-bitcoin-src.XXXXX')

# Ignore errors from now on
set +e

# Move source cache if it exists (atomic)
mv /tmp/nix-bitcoin-src $tmp/src 2>/dev/null
mv /tmp/nix-bitcoin-src $tmp/src 2>/dev/null || true

rsync -a --delete --exclude='.git*' "$scriptDir/../" $tmp/src && \
echo "Copied src" && \
_nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}"
atExit() {
# Set the current src as the source cache (atomic)
mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null || true
rm -rf $tmp
}
trap "atExit" EXIT

# Set the current src as the source cache (atomic)
mv -T $tmp/src /tmp/nix-bitcoin-src 2>/dev/null
rm -rf $tmp
rsync -a --delete --exclude='.git*' "$scriptDir/../" $tmp/src
echo "Copied src"
_nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}"

0 comments on commit eddc48e

Please sign in to comment.