File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -81,20 +81,29 @@ def test_victoria_with_interrupt():
8181 try :
8282 python_cmd = sys .executable
8383
84+ # On Windows we need a process group to send CTRL_BREAK_EVENT
85+ creationflags = 0
86+ if platform .system () == 'Windows' :
87+ creationflags = subprocess .CREATE_NEW_PROCESS_GROUP
88+
8489 # Start the process
8590 process = subprocess .Popen (
8691 [python_cmd , 'victoria.py' ],
8792 stdin = subprocess .PIPE ,
8893 stdout = subprocess .PIPE ,
8994 stderr = subprocess .PIPE ,
90- text = True
95+ text = True ,
96+ creationflags = creationflags
9197 )
92-
98+
9399 # Let it run for a moment
94100 time .sleep (1 )
95-
101+
96102 # Send interrupt signal (Ctrl+C)
97- process .send_signal (signal .SIGINT )
103+ if platform .system () == 'Windows' :
104+ process .send_signal (signal .CTRL_BREAK_EVENT )
105+ else :
106+ process .send_signal (signal .SIGINT )
98107
99108 try :
100109 stdout , stderr = process .communicate (timeout = 5 )
You can’t perform that action at this time.
0 commit comments