From 51a5949be11132f91655ed07b90ec60b8d1d06bd Mon Sep 17 00:00:00 2001 From: Maor Hamami Date: Fri, 6 Mar 2026 10:28:18 +0200 Subject: [PATCH] [windows] use truncate instead of rm to avoid file in use error + remove \r to avoid crlf diff --- btest | 2 +- btest-bg-wait | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/btest b/btest index d63c410..1799bb4 100755 --- a/btest +++ b/btest @@ -1188,7 +1188,7 @@ class Test: error(f"cannot write test's additional file '{fname}'") for line in lines: - ffile.write(line) + ffile.write(line.replace("\r\n", "\n")) ffile.close() diff --git a/btest-bg-wait b/btest-bg-wait index e8437af..ed06a00 100755 --- a/btest-bg-wait +++ b/btest-bg-wait @@ -85,7 +85,11 @@ function kill_procs { } function collect_output { - rm -f .stdout .stderr + # Truncate rather than rm: on Windows the parent process (btest) + # still holds these files open and rm would fail with EBUSY. + # Truncation is allowed because btest opens them with write-sharing. + : >.stdout + : >.stderr if [ $timeout_ok != 1 ] && [ -s .timeout ]; then {