Skip to content
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

Signal equivalent on Windows #45

Closed
wants to merge 9 commits into from
Closed

Conversation

frou
Copy link

@frou frou commented Nov 27, 2017

Hi Aldo. We talked about this briefly a while back in this issue.

To recap...

Windows doesn't support signals. So, the feature of modd whereby it can be configured to communicate with daemons by sending signals to them does not work on Windows. The signals silently fail to do anything.

(The exception to this is SIGKILL, which the Go runtime recognises the intent of, and uses a native Windows API to directly kill the target process).


I have added a feature I've called "Pipe Signals" to modd. I've made it so that it can only be enabled on Windows, because there's no need for it on other OSes where normal signals work fine.

When Pipe Signals is enabled, daemons are started with a pipe connected to their STDIN. Instead of a signal being sent to the daemon, the textual name of the signal is written as a line on that pipe instead, e.g. hangup\n or interrupt\n.

The daemon process can read its STDIN and take appropriate action. For example, I have also updated devd to be able to consume hangup in that way to cause a livereload on Windows.

Currently the feature is disabled by default (enabled using modd --pipesignals).

What do you think?

@cortesi
Copy link
Owner

cortesi commented Dec 5, 2017

Hi Duncan. Let me mull this over a bit. I like the approach, and I wonder if there is an argument for making this more general - that is, whether the ability to write to a process's stdin rather than send a signal might be useful in other cases on all platforms.

@frou
Copy link
Author

frou commented Dec 6, 2017

Something to keep in mind is that it's probably a worthy goal for an identical modd.conf file to"just work", whether the user is on Unix or Windows. Presumably we don't want to get into a situation where projects have both a modd-unix.conf and modd-windows.conf?

@frou
Copy link
Author

frou commented Dec 6, 2017

In that line of thinking, I can imagine the following as modd.conf syntax:

Use a signal:

daemon +sighup: devd -m .

Use a message:

daemon |reload: devd -m .

Use a signal if the OS supports it, otherwise use a message:

daemon +sighup|reload: devd -m .

@ghost
Copy link

ghost commented Mar 17, 2018

Remove all kits please

@frou
Copy link
Author

frou commented Oct 21, 2018

Since I'm no longer using Windows for development, I'm not fussed about this mechanism any more

@frou frou closed this Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants