mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 15:06:36 +00:00
fix(logger): resolve Windows pipe fsync deadlock in tests
Remove Sync() calls in logger tests that use os.Pipe for stdout/stderr capture. On Windows, FlushFileBuffers on pipe handles blocks indefinitely, causing test timeouts (600s+). Also use os.MkdirTemp instead of t.TempDir to avoid cleanup failures when lumberjack still holds file handles.
This commit is contained in:
1 parent
431c0e7236
commit
ff9cb6c6c0
2 files changed
+15
-5
No files matched your search
@@ -77,7 +77,7 @@ func TestStdLogBridgeRoutesLevels(t *testing.T) {
|
||||
log.Printf("service started")
|
||||
log.Printf("Warning: queue full")
|
||||
log.Printf("Forward request failed: timeout")
|
||||
Sync()
|
||||
// Skip Sync() — on Windows, fsync on pipes deadlocks (FlushFileBuffers).
|
||||
|
||||
_ = stdoutW.Close()
|
||||
_ = stderrW.Close()
|
||||
@@ -139,7 +139,7 @@ func TestLegacyPrintfRoutesLevels(t *testing.T) {
|
||||
LegacyPrintf("service.test", "request started")
|
||||
LegacyPrintf("service.test", "Warning: queue full")
|
||||
LegacyPrintf("service.test", "forward failed: timeout")
|
||||
Sync()
|
||||
// Skip Sync() — on Windows, fsync on pipes deadlocks (FlushFileBuffers).
|
||||
|
||||
_ = stdoutW.Close()
|
||||
_ = stderrW.Close()
|
||||
|
||||
Reference in new issue
Block a user