test(cli): verify closed log files portably on Windows

Use Write rather than Stat to verify retained file handles are closed.
Windows Stat returns ERROR_INVALID_HANDLE instead of os.ErrClosed.
Retain final-cleanup content assertions and strict closed-error matching.
This commit is contained in:
Dev Scribe authored and Cuong Manh Le committed 2026-09-28 16:52:10 +07:00
1 parent f52dfd0354
commit 72507f3e2c
1 file changed
+1 -1
+1 -1
View File
@@ -36,7 +36,7 @@ func TestFinishRunClosesInternalFilesWithoutServiceStop(t *testing.T) {
close(p.runDone)
p.finishRun()
for i, f := range files {
if _, err := f.Stat(); !errors.Is(err, os.ErrClosed) {
if _, err := f.Write([]byte("unexpected write\n")); !errors.Is(err, os.ErrClosed) {
t.Errorf("file %d is not closed: %v", i, err)
}
b, err := os.ReadFile(paths[i])