-
Notifications
You must be signed in to change notification settings - Fork 115
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
用了这么,终于可以提一个 Bug 了 #253
Comments
感谢。我最近会修复下。 |
最近一周有点忙,15号之后有时间修复。或者 @botsphp 也可以提pr,合作修复。 |
@guonaihong 我试试吧,我不太清楚如何在 Windows 下,识别windowsgui的状态,初步的想法是捕获这个异常,不影响使用即可。 |
@botsphp 原谅我不厚道的笑了 |
比如? |
这个现象分析了下,go里面的打印函数只能向终端输出日志,gui的环境输出会报错。 在windows gui输出日志,我这边找到一个方法。你看下面的代码可以在你的windows gui里面输出信息不? @botsphp modkernel32 := syscall.NewLazyDLL("kernel32.dll")
procAllocConsole := modkernel32.NewProc("AllocConsole")
r0, _, err0 := syscall.Syscall(procAllocConsole.Addr(), 0, 0, 0, 0)
if r0 == 0 {
fmt.Printf("Could not allocate console: %s. Check build flags..", err0)
os.Exit(1)
}
hout, err1 := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE)
if err1 != nil {
os.Exit(2)
}
os.Stdout = os.NewFile(uintptr(hout), "/dev/stdout")
os.Stdout.Write("hello word") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
工具很好,一直也想参与做点贡献,终于等到这一天了。
在 Winddows 上,如果使用 Debug = true 并同时开启编译参数
-ldflags "-H windowsgui"
,则会抛出如下异常write /dev/stdout: The handle is invalid.
因为这个 bug 折腾了两个小时,好不容易定位原因了,也算做出一点贡献了。我的解决办法是在 Windows 下,Debug 直接关闭就好了。
The text was updated successfully, but these errors were encountered: