[Pitch] Swift Subprocess

I don't think we can leave this for future considerations. Every API needs to respect task cancellation otherwise your process might get stuck because we are using a Subprocess somewhere that just never ends. I would start with just sending a SIGKILL to the subprocess. This will make sure that we are shutting down the subprocess and the user code that might run in the closure will also get the cancellation.

In the future, we can then revisit this and see if we need the cancellation behaviour customisable; however, in my opinion this is something that the language should solve rather than every individual API. A concept like cancellation shields would allow users to opt-out of automatic cancellation propagation in parts of the application where they want to handle it differently.

13 Likes