Comments (15)
I have this problem again.
go version go1.16.3 windows/amd64
There's a dirty way: https://learnku.com/articles/51696
from endless.
syscall
being undefined sounds fishy - that's stl...
have you set GOPATH
and GOROOT
environment variables?
from endless.
Yes, GOPATH and GOROOT are both set. Just to be safe I set them in both user and system environment variables.
from endless.
hm. which version of go do you run?
from endless.
Only standard signals are defined under windows, the more custom ones like SIGUSR1 etc simply don't exist so no this wont work under windows.
from endless.
i see. we'd have to use go generate
to get a different version compiled on windows i guess? does anybody know how that works?
from endless.
Not sure I follow you there @fvbock signals don't really exist on windows.
If you wanted to be portable I would suggest you remove the signal handling from the core of endless replacing with something like a message channel or action messages which the user of endless can implement how they see fit.
This would allow a unix daemons to use signals but a windows service to use service codes for example.
Another benefit of this is that your compatible with existing code which may well already be doing something different with signals.
from endless.
@stevenh that's what i meant.
there is stuff like this https://golang.org/src/syscall/syscall_windows.go#L16 - to get different versions depending on what platform you compile. so replacing the signals with something canonical on windows...
i know in general how go generate
works but never used it and wonder if somebody has done something like this (platform detect - generate different src - compile) to look at.
from endless.
Yer the problem is more that there is no good replacement on windows so it would always need to be implementation specific.
In my head removing signal handling totally and just straight exported methods for:
- Shutdown (just export shutdown)
- Upgrade (fork from SIGHUP case)
- Terminate (just rename hammerTime)
This makes it all much cleaner as the user of endless on unix can decide what signals they want to use and call the relevant methods, no having to hook signals any more.
Does that make sense?
from endless.
the canonical way to tell a unix program to shutdown, restart, or terminate is to send it a signal. i don't plan on changing how that is handled in endless.
for the std behaviour you dont have to hook stuff in yourself - endless sets them up. i recently added a function to add hooks without having to do ugly append stuff https://github.com/fvbock/endless/blob/master/endless.go#L541:L559
if windows has a different way of doing signals (and it is not encapsulated in golangs stl/syscall library) it might be nice to use go generate
or something similar to get a version that works on windows.
exporting the shutdown(), fork(), etc functions - and the endlessServer itself might be another thing. then develops can choose what they want to do - restart via a signal or with a call if they need it...
from endless.
I agree signal handling is the standard way of doing things on unix but each flavour has its own way.
So I guess what I'm saying is allowing endless to be used as a configurable component flexible enough to work how the user wants instead of taking a fixed view provides more options. This is also very idomatic in go, small components that do one job and one job well.
It would be easy to keep the signal handling but as something separate that the user can choose to use if it fits their use case so you end with the best of both worlds. Two separate calls ListenAndServeSignal and ListenAndServeTLSSignal which add the signal support but are contained in a endless_unix.go that has // +build !windows spring to mind as really easy to do.
I'll try knock something up as an example if I get some free time.
from endless.
i like the idea of having a choice - i would like to keep ListenAndServe
and ListenAndServeTLS
- having dropin replacements for the stl is nice...
maybe doing something with env_vars. telling endless whether to start with or without signal handling on... will have to think about it a bit too.
from endless.
Here's what I was thinking @fvbock #19
from endless.
@fvbock I need this to work in Windows.
Are the 3 PRs by @stevenh going to merged any time soon?
from endless.
wow..I have this problem again~
four years so far
from endless.
Related Issues (20)
- FD leak on linux after restart HOT 1
- can't this project build in Windows? HOT 6
- systemd init script HOT 3
- can't work with systemd HOT 2
- accept tcp 127.0.0.1:4242: use of closed network connection HOT 3
- endless.NewServer() Struct Variable
- how to use with r.Run(":8080") and r.RunTLS(":8443", "server.pem", "server.key") HOT 1
- Support Http2.0 HOT 1
- add go mod
- fork() should use cmd.Run() rather than cmd.Start() HOT 1
- go build command-line-arguments: copying /tmp/go-build042781492/b001/exe/a.out: open main: text file busy
- net.FileListener error: file file+net : getsockopt: socket operation on non-socket
- POST_SIGNAL shutdown server not run
- I tried to get the app to send a SIGHUP signal to reload itself and got a "text file busy" error
- Build for Windows on compilers smaller than go1.10 HOT 1
- windows endless.go:64:11: undefined: syscall.SIGUSR1 HOT 1
- Abandoned project? HOT 3
- reload daemon then http server can't listen on other port
- can't use go build, show too many errors
- Feature Request: Support Listeners on Unix sockets instead of TCP
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 endless.