Comments (3)
Adding -ldflags -H=windowsgui
to go build
command produces a GUI executable and Windows stops allocating console automatically. I tested with NSSM and sol is working without spawning conhost
from sleep-on-lan.
I see your point, but i have no idea how to achieve that.
Do you have any evidence that it's possible / any clue about how to technically speaking achieve this ?
Because as far as i can tell, a windows program either has to be a "form-based" application (with a GUI), either a "console" application (launchable in a standalone way - and here of course with a console, or through a service machanism (here, just as a proposal, with the external tool NSSM).
And have you tried this, by the way, per the NSSM documentation ? (@see https://nssm.cc/usage)
Console window
As of version 2.22, nssm will by default create a new console window for the application. This allows some programs to work which would otherwise fail, such as those which expect to be able to read user input. The console window can be disabled if it is not needed by setting the integer (REG_DWORD) value AppNoConsole under HKLM\System\CurrentControlSet\Services\servicename\Parameters to a non-zero value.
Otherwise for reference, i have not found a lot of informations about that topic in golang :
- this is about hiding the console (but it will still be visible inside TaskManager with a conhost.exe extra line, i would say) : https://github.com/ifrstr/hideconsole/blob/master/hideconsole_win.go
- there is a "DETACHED_PROCESS" pure-indows property, used for example here, but not clear if this would work : https://github.com/tinygo-org/tinygo/blob/release/util_windows.go
- there are huge golang frameworks like "https://github.com/judwhite/go-svc" (allowing to have the binaries themselves being able to register as a windows service), but a) i don't know if that would work anyway (about not having a "conhost.exe" associated process) and b) i really don't like this approach, which is not at all going in the good direction (wrapping as a service should be done around the processes ("unix philosophy"), and not with a lot of code inside the processes themselves)
from sleep-on-lan.
Sorry, I have no experience with Go so I don't know if it's possible within that framework.
The closest thing I can think of, with an app that stays resident but has no console window, would be something like a compiled AutoHotkey script. Those have a system tray icon to (minimally) just exit the program. I don't know if that's something you'd consider replicating here or not.
Unfortunately I'd already tried setting NSSM to not have a console window (it's also a checkbox in NSSM's interactive UI) but sol still spawns one. I also tried redirecting stdin and stdout to <NUL
and >NUL
respectively, but the console process still starts.
from sleep-on-lan.
Related Issues (20)
- Switch logging framework to logrus
- Add missing target platform
- add commands doesn't work HOT 12
- Only allow expected command types in custom commands definition
- Log file or event log on Windows? HOT 2
- Incorrect example for Commands? HOT 3
- Have better "default configuration" generated
- Split the ZIP distribution into one archive per platform
- Split README.md into separated pages
- New --verbose parameter
- Extra default filenames
- Logs where not displaying timestamps in line with system's timezone
- No response for HTTP sleep HOT 2
- Have extra delay before executing command HOT 3
- PC sleeps immediately after Wake on Lan after having used sleep on lan HOT 5
- Wake on LAN works strange when service work HOT 1
- VirusTotal scan results HOT 1
- Build binaries for x86 architecture HOT 1
- Commands cannot execute. I think the Execute function in SR-G/sleep-on-lan/src/utils_system.go is bugged.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sleep-on-lan.