dotnet / dotnet/crank

Unexpected blast radius of CTRL+C when running on Windows

Open
#625 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.1k
Forks
111
Avg merge
2d 21h
Merged PRs (30d)
3

Description

I have a power shell script which Start-Process $N independent cranks which will, in turn, start up independent copies of the techempower webserver app. The powershell script finally runs a python program which doesn't intentionally exit, so the powershell script itself doesn't exit. Loads are presented and serviced.

Something causes crank to "Sending CTRL+C" which has the unfortunate side effect of killing off my python program, and ALL of the other running crank instances as well. It seems you are calling GenerateConsoleCtrlEvent(CtrlTypes.CTRL_C_EVENT ...) which I infer goes rather broadly and kills my python program. Why is the CTRL+C being sent? Why so broadly?

I am Start-Process my independent cranks with the "-NoNewWindow" argument, hoping (following Linux) that would run all of the cranks in parallel, all sharing stdout and stderr, and, indeed that is the case. But CTRL+C is sent, apparently, to all tasks sharing the same window.

I can avoid this issue by Start-Process without the -NoNewWindow; I end up with one window per crank, and the blast radius of CTRL+C is appropriately limited. But what do I do when I want to launch all of this from within a ssh session, or I do not have access to video?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.