Repository navigation
feat: prevent conhost from pop-up on Windows - #10334
rafaeloledo wants to merge 1 commit into
Conversation
|
Yeah we've had this up as a suggestion a few times, potentially as a separate build that is also shipped beside the regular one. The problem with having it as the default as you suggest is that all the CLI commands that Syncthing provide become useless. Including stuff like just running |
|
While I'm glad, seing this PR, I'll suggest to use a seperate build, as the cli will be broken with that flag |
|
Can we work, then, in a separate build similar to Starting doing some research on how |
|
It requires a few more changes to ship two binaries using our build process, I made a couple of attempts but first attempt got pushback, second attempt got crickets, so I concluded nobody really cares about it: #8760 |
|
If you want to take that attempt and rework it into the current version, I don't think it should be too many changes from what was there, I think we can work with that. |
|
@AudriusButkevicius Seems that only you are not sure of the changes. Before aiming that idea i've tried similar changes that mentioned in #8760 . In syncthing/docs#926 i've shown that the only way of hiding the window from pop-up beside creating another build
You have a suggestion, then? |
|
Tested
cmd /C "syncthing.exe --no-console --no-browser"The window pops similar to So, only |
|
Is powershell available everywhere relevant, can we just ship a |
It's the last resort possibility if no ones fit.
Start-Process -FilePath "syncthing.exe" -ArgumentList "--no-console --no-browser" -WindowStyle HiddenThis works with the console build but also needs modifying, by hand, the For the
schtasks /create /sc ONLOGON /tn Syncthing /tr "$expanded_path_to_ps1" |
Not sure how useful it would be, as running unsigned PowerShell scripts is blocked by default in Windows, and I assume that the main target of having a version of Syncthing that runs completely hidden are the non-tech-savvy, who won't be changing this setting (which is a good thing in terms of security). |
|
Can we sign it to make it useful? We codesign the normal binary. |
We can ship the installation with a |
|
Honestly, I think having a separate |
@tomasz1986, is only possible to merge with @AudriusButkevicius review? In the last PR made by @calmh, he noted that two binaries aren't necessary. |
I also think this, considering that no changes in the docs are needed with the changes. Only updating the places where |
|
It totally is, and we could have done so previously, but there was no one else that had a positive view of it either. And windows isn't my platform, so I didn't really feel like spearheading the effort too strongly. This isn't a "Audrius said no", it's "Audrius tried to provide a better alternative, then nobody else cared either way". :) |
So, the work of investigating is done by me. Only |
|
I think it would be great to commit all the changes here and let him remove the not desired. How can i open to you merge your PR changes @calmh ? |
|
I would say that the situation has changed with Windows Terminal becoming the default shell, and thus |
|
+1 from me for a dedicated binary. That's also how e.g Java handles this. All this Powershell and task scheduler stuff is just hacky IMHO 🤷 |
Python as well (via |
|
In the meantime I created a PR for the root cause: #10335 |
Since @Shablone is trying to solve the problem in a different way, i'll continue integrating the solutions from #8760 and putting some This aims to make minor changes and the one from @Shablone is restructing the way |
|
Go for it. I don't think there's a need to keep invoking Audrius. If he has an opinion on it he'll be around. :) |
|
@calmh I think a3bed33 is the best i can do for integrating I've added |
|
So, looking at how these things apparently actually work in Windows, this doesn't help with the somewhat basic desire to have something that you can double click to start Syncthing without having a console window remain on screen. It seems to me then that it is not enormously useful and fits better either in an etc dir (like we ship startup suggestions for other systems, in this case it'd be in windows-taskscheduler or something with the scripts and a readme) or as instructions on the docs site. |
|
On a side note, there is also Syncthing Windows Setup (which we recommend on the official site) that can take care of the whole installation and autostart operation. |
This contribution is aimed for those who not use wizards or managers. I manage my entire programs with For all my teammates that are using Windows i recommend the installer. Asking for using yet another tool when having a meeting is out of my mind. I've been merging PRs quite a while in Windows just to it have a better experience without GUIs and Managers. Simplifying, making Windows more similar to Linux in this matter. |
|
Yeah, but isn't it better to just utilise the existing Windows Setup for that? It supports various command line arguments, including silent installation, per-user installation, installation as a service, etc. It is also available via WinGet, which makes deployment easy. |
It's not related to what is better. I prefer to let the user decide it. Syncthing Windows Setup could be a good program and using CLI tools too, it's just a preference. As a terminal-based user, i tend to use terminal for as much work as i can. If I'm current working on making the scripts work being shipped inside the |
|
Bad news. After some tests, i've discovered that, in my old ones, the Poweshell 5.1 was opened and the process was being reutilized the same way as conhost reutilizes itself. The @calmh the only way to fix this is in fact rebuilding the app as I will close this PR just because i consider my |
this change checks wether the current OS of compilation matches windows, if so, it assumes the form of a gui application which tells the OS to not spawn a conhost window Co-authored-by: Rafael Ledo <[email protected]> Co-authored-by: calmh <[email protected]> Co-authored-by: Shablone <[email protected]>


Purpose
This change prevents the
conhostprocess from popping. So the docs can remain the same and the--no-consoleflag remains working. If the change isn't made, it's needed to refactor the entire docs adapting it topowershell ... -Hiddenwrapping approach. Wrapping withconhost --headlessstill pops the terminal in abat/cmdscript since it's a compilation-related problem and the OS forces the window appearing if there's noconhostprocess in the tree, only working, then, inside a terminal, which less tech savvy users won't do.The problem of wrapping it with
powershell, though, it's that user must runExecutionPolicychanges similar toscoop.shwhich i think it's not desired.Testing
I've compiled the program in the GOOS matching
windowsand GOARCHamd64.You can reproduce in your machine quite easily. The problem is the default debug log is omitted on Windows.
weztermuses the approach ofwezterm.exeandwezterm-gui.exewhich could be desired in this case, depending on maintainers will.Screenshots
It's not a GUI change. The webclient is the same and it maintains working.
Documentation
Relates and may close syncthing/docs#957 and syncthing/docs#955.
Derived from syncthing/docs#926 and #8760
Authorship