Better signaling between processes #3514

Closed
opened 2026-01-30 23:22:56 +00:00 by claunia · 3 comments
Owner

Originally created by @giggio on GitHub (Aug 21, 2019).

Originally assigned to: @bitcrazed on GitHub.

Description of the new feature/enhancement

Provide better signal passing between processes, something similar to what Linux has to offer.

(I am aware this is not perhaps the best place to start this conversation, if you can find a better home for this issue, I'll gladly move it there.)

On Linux/Unix a process can signal another process very easily, and the process receiving the signal can also, easily trap it and decide how to react. So, ctrl+c, por example, generates a SIGINT signal, and the process receiving that signal can decide how to answer to that signal. In bash, for example, it is really easy to trap those signals and respond to them. Processes can also send signals other ways, like using kill.

On Windows it is really hard to work with "signals", even with ctrl+c, and the "signals" you can send are limited. Also, during my investigations, I noticed that, by default, if a parent process gets a ctrl+c, all it's childs also will, and if the parent disables that and spawns childs, and then reenable, it is then impossible to signal the children later.

I am trying to work with a console app that takes signal, and decides which processes it will forward the signal to. It doesn't seem possible on Windows. On *NIX it would be trivial.

Proposed technical implementation details (optional)

I am aware that this team is really careful to not break legacy code, so what I propose is a new signal layer, while keeping the old one untouched. This new layer could forward signals to the old one, and also get signals from the old one, while keeping compatibility. I am not aware how to implement that in a way that does not break things.

Originally created by @giggio on GitHub (Aug 21, 2019). Originally assigned to: @bitcrazed on GitHub. # Description of the new feature/enhancement Provide better signal passing between processes, something similar to what Linux has to offer. (I am aware this is not perhaps the best place to start this conversation, if you can find a better home for this issue, I'll gladly move it there.) On Linux/Unix a process can signal another process very easily, and the process receiving the signal can also, easily trap it and decide how to react. So, <kbd>ctrl</kbd>+<kbd>c</kbd>, por example, generates a `SIGINT` signal, and the process receiving that signal can decide how to answer to that signal. In bash, for example, it is really easy to trap those signals and respond to them. Processes can also send signals other ways, like using `kill`. On Windows it is really hard to work with "signals", even with <kbd>ctrl</kbd>+<kbd>c</kbd>, and the "signals" you can send are limited. Also, during my investigations, I noticed that, by default, if a parent process gets a <kbd>ctrl</kbd>+<kbd>c</kbd>, all it's childs also will, and if the parent disables that and spawns childs, and then reenable, it is then impossible to signal the children later. I am trying to work with a console app that takes signal, and decides which processes it will forward the signal to. It doesn't seem possible on Windows. On *NIX it would be trivial. # Proposed technical implementation details (optional) I am aware that this team is really careful to not break legacy code, so what I propose is a new signal layer, while keeping the old one untouched. This new layer could forward signals to the old one, and also get signals from the old one, while keeping compatibility. I am not aware how to implement that in a way that does not break things.
claunia added the Issue-FeatureNeeds-Tag-FixResolution-Won't-Fix labels 2026-01-30 23:22:57 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Aug 22, 2019):

handing off to @bitcrazed 😄

@DHowett-MSFT commented on GitHub (Aug 22, 2019): handing off to @bitcrazed :smile:
Author
Owner

@DHowett-MSFT commented on GitHub (Aug 22, 2019):

This may be quite related to #281 (which is like SIGWINCH)

@DHowett-MSFT commented on GitHub (Aug 22, 2019): This may be quite related to #281 (which is like `SIGWINCH`)
Author
Owner

@bitcrazed commented on GitHub (Aug 29, 2019):

Hey @giggio Appreciate the ask.

However, this is not something we're going to be able to support.

*NIX and Windows follow very different philosophical and architectural paths.

In *NIX, signals are used for many inter-process communications (IPC), but Windows has several IPC mechanisms that are designed for various specific scenarios, including RPC, pipes, mailslots, etc., and several interprocess synchronization and other synchronization mechanisms (e.g. locks, semaphores, mutexes, timers, and events), along with several thread/process control mechanisms. And because these are all kernel-provided mechanisms, they can all be ACLed, and managed in sophisticated ways.

These mechanisms delivers to Windows developers a great deal of power, flexibility, and control - moreso, perhaps that *NIX offers - but ... as you point out ... there's no direct 1:1 mapping with *NIX signals.

Could this be remedied? Maybe. Possibly. But, alas, it's way out of our sphere of influence and control. However, it is something that we hear from time to time, and we do on occasion do what we can in the command-line to better supported expected command-line scenarios, but WE aren't going to be able to inject a signalling mechanism into the kernel ;)

Closing since there's no further action we can perform to make this happen . Sorry!

@bitcrazed commented on GitHub (Aug 29, 2019): Hey @giggio Appreciate the ask. However, this is not something we're going to be able to support. *NIX and Windows follow very different philosophical and architectural paths. In *NIX, signals are used for many inter-process communications (IPC), but [Windows has several IPC mechanisms](https://docs.microsoft.com/en-us/windows/win32/ipc/interprocess-communications) that are designed for various specific scenarios, including RPC, pipes, mailslots, etc., and several [interprocess synchronization](https://docs.microsoft.com/en-us/windows/win32/sync/interprocess-synchronization) and [other synchronization](https://docs.microsoft.com/en-us/windows/win32/sync/about-synchronization) mechanisms (e.g. locks, semaphores, mutexes, timers, and events), along with several [thread/process control mechanisms](https://docs.microsoft.com/en-us/windows/win32/procthread/process-and-thread-functions). And because these are all kernel-provided mechanisms, they can all be ACLed, and managed in sophisticated ways. These mechanisms delivers to Windows developers a great deal of power, flexibility, and control - moreso, perhaps that *NIX offers - but ... as you point out ... there's no direct 1:1 mapping with *NIX signals. Could this be remedied? Maybe. Possibly. But, alas, it's way out of our sphere of influence and control. However, it is something that we hear from time to time, and we do on occasion do what we can in the command-line to better supported expected command-line scenarios, but WE aren't going to be able to inject a signalling mechanism into the kernel ;) Closing since there's no further action we can perform to make this happen . Sorry!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3514