Skip to content

Commit a18d516

Browse files
committed
Fix the termination of MiniZinc and its subprocesses on windows
1 parent 0874d1e commit a18d516

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/minizinc/instance.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,12 @@ async def solutions(
452452
# Process was cancelled by the user, a MiniZincError occurred, or
453453
# an unexpected Python exception occurred
454454
# First, terminate the process
455-
proc.terminate()
455+
if sys.platform == "win32":
456+
import signal
457+
458+
proc.send_signal(signal.CTRL_C_EVENT)
459+
else:
460+
proc.terminate()
456461
_ = await proc.wait()
457462
# Then, reraise the error that occurred
458463
raise

0 commit comments

Comments
 (0)