-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync /dev/stdout: The handle is invalid. #991
Comments
I believe the issue is that
This refers to the unix error ENOTTY. I'm not sure what the Windows equivalent of that is.
|
Thank you for your help! Unfortunately, it didn't work. On Windows, the error seems to be of type os.PathError Did a I did not dare to catch and skip such kind of error, because I might also have a file logger core, which theoretically could run into a real path error!? Instead I hardened my code bending skills and came up with the following fix. I defined my own implementation of the
Using it this way:
Additional logger cores / WriteSyncers should not be affected by this and work as usual... |
Thanks for the workaround, @noneymous! I'll leave the issue open while the workaround is still needed. |
I have used this method to check if the error is related. I have a Mac system and I get the following error:
EBADF = Errno(0x9) |
Hi,
I'm using Zap in a Windows executable. I'm trying to tee multiple cores together, which is working fine. One of them is a standard Zap console core using os.Stdout. On program termination, I'm closing down all loggers, which also includes calling
.Sync()
. The sync function works fine on my cores but fails on the console logger (It seems the stdout handle is already gone). I'm wondering, if there is something I can do about it...Here is a basic code sample (only involving the console core) demonstrating the issue:
Here is the output,
.Sync()
failed on this console logger:Just to make it clear, I cannot skip calling .Sync() because I have multiple cores teeed together which need the Sync call.
The text was updated successfully, but these errors were encountered: