]> git.ipfire.org Git - thirdparty/git.git/commit
t/test-lib: silence EBUSY errors on Windows during test cleanup
authorPatrick Steinhardt <ps@pks.im>
Thu, 4 Jun 2026 10:07:36 +0000 (12:07 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Jun 2026 12:49:00 +0000 (21:49 +0900)
commitd11968661e641ea81f4c1938ae9f73a54107dc62
tree4e9e8ca965654131064a029417b0aadcdff71fd0
parentb1688db759de18a8403945090688b8cc25ba26dd
t/test-lib: silence EBUSY errors on Windows during test cleanup

When tests have finished we clean up the trash directory via `rm -rf`.
On Windows this can fail with EBUSY in cases where a process still holds
some of the files open, for example when we have spawned a daemonized
process that wasn't properly terminated. We thus retry several times,
but every failure will result in error messages being printed, and that
in turn breaks the TAP output format.

One such case where this is causing issues is in t921x, which contains
tests related to Scalar. Some tests spawn the fsmonitor daemon, and we
never properly terminate it.

The obvious fix would be to ensure that we never leak any processes, but
that gets ugly fast. Instead, let's work around the issue by silencing
error messages printed by the `rm -rf` calls. We already know to print
an error when the retry loop fails, so we don't loose much.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh