You could log to a file. If you're willing to take in a -log flag, you could take a path as well and log to this file. That way you don't need 2 binaries, however you'd need to tail the file, which seems to me better than 2 binaries.
Best, Anderson On Friday, April 29, 2022 at 2:47:06 PM UTC+2 stephen.t....@gmail.com wrote: > You're right, it is a Windows issue. I can see that now. I bought up the > issue originally because I was unsure if there was something in addition to > -H=windows or -H=windowsgui that I could make use of. My understanding of > Windows is now exhausted. > > The alternative way is to have two binaries for the Windows version. > On Friday, April 29, 2022 at 1:22:45 PM UTC+1 jake...@gmail.com wrote: > >> This is really a Windows issue, and not related to Go. According to this >> very old post: >> https://stackoverflow.com/questions/493536/can-one-executable-be-both-a-console-and-gui-application >> >> it is technically possible to do that, but the technique has flaws, foibles >> and limitations. >> >> This sounds like a 'rabbit hole' to me. I would suggest going back to >> what you actually want to accomplish, and thinking about alternative ways >> of achieving it. >> >> On Friday, April 29, 2022 at 4:46:19 AM UTC-4 stephen.t....@gmail.com >> wrote: >> >>> Hello Alex. Thanks for your response. >>> >>> On Fri, Apr 29, 2022 at 9:34 AM brainman <alex.b...@gmail.com> wrote: >>> >>>> Once windows executable is built, go has no control over how this >>>> program executes. >>>> >>>> When command line program is executed by clicking in explorer window >>>> Windows automatically starts a new console window and the console is used >>>> for stdout output (I did not check that). If command line program is >>>> started from existing cmd.exe console, new process just uses the same >>>> console. >>>> >>>> When you click on GUI executable in Windows explorer, no console >>>> windows is started (I did not check that). Same for GUI executable started >>>> from cmd.exe console - new GUI process is not attached to parent console >>>> (I >>>> did not check that). >>>> >>> >>> Right. So I have a GUI executable that might be launched from a console >>> but it will not be "attached" to that parent console. >>> >>> Is there a way to attach the GUI executable to the parent console, >>> perhaps using a Windows system call? >>> >>> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/95689cc2-ec6b-466f-ba3b-72a41756b328n%40googlegroups.com.