Skip to content

Commit

Permalink
Fix the termination of MiniZinc and its subprocesses on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekker1 committed Oct 8, 2024
1 parent 0874d1e commit a18d516
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/minizinc/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,12 @@ async def solutions(
# Process was cancelled by the user, a MiniZincError occurred, or
# an unexpected Python exception occurred
# First, terminate the process
proc.terminate()
if sys.platform == "win32":
import signal

proc.send_signal(signal.CTRL_C_EVENT)
else:
proc.terminate()
_ = await proc.wait()
# Then, reraise the error that occurred
raise
Expand Down

0 comments on commit a18d516

Please sign in to comment.