-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Don't create a windows gui application for fyne build
#3781
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
Conversation
fyne build should not add -H=windowsgui by default because it makes debugging much difficult
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that should be the default behavior even for the build command. If you call fyne build, it is likely from a terminal. So needing an additional window to write logs to when you're already in a terminal isn't really the most likely case. I do understand that you might want still want that behavior in other case, like distributing a debug build. I think in that case we could have a debug flags that will turn on the terminal and potentially additional things that will help collecting debugging information.
This patch actually solves this. -H=windowsgui detaches console from application and we can't see stdout and stderr. With this pacth I am no longer needed to create another debugging outputs (eg. log file), I will just use the terminal I build on and see the output.
This is not about distributing debug builds but just only for monitoring stdout for debugging purposes. Also this is default only for windows, linux and macos builds all have console, why it should be disabled on windows debug build. I can't just use |
I may have missed it, but this patch always turn on the additional terminal window on windows when using fyne build. I think that should not be a default behavior. It should be only on when you explicitly ask for it. |
Not additional terminal window, it just prevents detaching from terminal only for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Bluebugs. It is better to keep the current behaviour and instead add a flag to enable the terminal popup for those that want to do so.
Just one question: Does passing |
Yes exactly |
I just tested this because it seemed implausible... That does not seem to be the case. I just built Fyne Demo using Maybe I did it wrong, but that seems like it is debuggable just like in other OS despite having that flag added. |
Please try this on windows
You will see the difference, First one built with |
I did do it in Windows. Using the install sepcified in our getting started pages (MSYS2 Mingw64). |
May I ask what happens when you build with |
Apologies, a typo. That was what I was testing. "fyne build ." Produces an app with metadata injected and when executed as "./fyne_demo.exe" it logs to the console it is connected to. |
Sorry but this is not what happens to me. I also use msys2 mingw64 and when I built fyne_demo with |
Can you step through how you launch the built executable? Earlier messages were not explicit enough for me to follow exact steps |
Here some information:
Steps:
It doesn't show stdout in every shell I tested it, app is detached from console immediately |
Would it perhaps make sense that ldflag could be disabled only when building using |
Agreed, that was my realisation as well. |
Ahaha I finally realised why this was happening to some and not others - cmd and PowerShell fork GUI apps but MSYS2 and Cygwin etc don't. So for now just use a "unix like" terminal and you'll get the output. |
Sounds great. Should we document that somewhere? |
I remember I also tested with msys but I got the same result. But if it works on you then I maybe did something wrong. Maybe because I started msys in cmd shell I don't remember exactly. Anyway IMO it would be nice to have a simple note on the website's Windows development page. |
It seems to me like we agreed in the team that the previous behavior is more correct. I'll close this now given how long it has been open. We value the contribution a lot and I'm sorry for having to close this. |
I have a related problem and would like an option to disable My environment:
Steps: Run package main
import (
"fmt"
"os"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
fmt.Fprintln(os.Stdout, "out")
fmt.Fprintln(os.Stderr, "err")
a := app.New()
w := a.NewWindow("win")
w.SetContent(widget.NewLabel("win"))
w.ShowAndRun()
} Run package main
import (
"fmt"
"os"
"os/exec"
)
func main() {
cmd := `<EXECUTE FILE PATH>`
c := exec.Command(cmd)
c.Stdout = os.Stdout
c.Stderr = os.Stderr
fmt.Println(c.Run())
} If you run the executable generated by Simply disabling |
The "fyne" tool is for building the GUI bundle - and Windows will not allow that to log. |
There is no way to embed I think the quickest way to solve this problem is to provide a way to disable |
I think what you are describing is a separate issue. metadata not being included should not be tied to the status of internal build flags. If there isn't already an issue open perhaps it is worth creating one to work through that? |
I have tried to create an issue, but the solution is unclear. #4688 |
Thanks. Issues don't need solutions anyway - that is for us to figure out I guess... |
Description:
Currently
fyne build
and all other commands sets-H=windowsgui
on windows and this makes debugging nearly impossible.Because
fyne build
is lower level than others and tries to mimicgo build
it is better to just generate a console app to make debugging easier. After this patchfyne build
will generate console apps on windows by default but doesn't change others, allpackage
,release
andinstall
commands will continue to generate gui apps.Fixes #3604
Checklist: