summaryrefslogtreecommitdiff
path: root/tests/rm/dangling-symlink.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rm/dangling-symlink.sh')
-rwxr-xr-xtests/rm/dangling-symlink.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/rm/dangling-symlink.sh b/tests/rm/dangling-symlink.sh
index 5fb50ecd1..d2e08a8ac 100755
--- a/tests/rm/dangling-symlink.sh
+++ b/tests/rm/dangling-symlink.sh
@@ -25,9 +25,10 @@ print_ver_ rm
ln -s no-file dangle
ln -s / symlink
+# Terminate any background processes
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
-rm ---presume-input-tty dangle symlink &
-pid=$!
+rm ---presume-input-tty dangle symlink & pid=$!
# The buggy rm (fileutils-4.1.9) would hang here, waiting for input.
# Wait up to 3.1s for rm to remove the files
@@ -40,6 +41,6 @@ check_files_removed() {
}
retry_delay_ check_files_removed .1 5 || fail=1
-kill $pid > /dev/null 2>&1
+cleanup_
Exit $fail