[repo] Hook self-test: keep its source files next to the work dir by absolute path and remove them first, so a run leaves nothing behind
This commit is contained in:
@@ -65,8 +65,11 @@ expect_staged() {
|
||||
|
||||
B='-----BEGIN'
|
||||
E='-----END'
|
||||
mkdir -p "$WORK/../ianitor-hook-src.$$" && SRC="$WORK/../ianitor-hook-src.$$"
|
||||
trap 'rm -rf "$WORK" "$SRC"' EXIT INT TERM
|
||||
# An absolute path next to $WORK (not "$WORK/..", which no longer resolves once $WORK is gone),
|
||||
# removed first.
|
||||
SRC="$(dirname "$WORK")/ianitor-hook-src.$$"
|
||||
mkdir -p "$SRC" || exit 2
|
||||
trap 'rm -rf "$SRC" "$WORK"' EXIT INT TERM
|
||||
printf '%s RSA PRIVATE KEY-----\nMIIBOgIBAAJBAK\n%s RSA PRIVATE KEY-----\n' "$B" "$E" > "$SRC/pem"
|
||||
head -c 6291456 /dev/zero | tr '\000' 'a' > "$SRC/six-mb"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user