mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
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:
1 parent
f52dfd0354
commit
72507f3e2c
1 file changed
+1
-1
@@ -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])
|
||||
|
||||
Reference in new issue
Block a user