Skip to content

Commit

Permalink
Add try-except for process.send_signal so it can work on Windows. (#3…
Browse files Browse the repository at this point in the history
…1574)

The current subprocess_server uses process.send_signal to terminate the process. On Windows, this will raise a ValueError, as .terminate() should be used instead.
  • Loading branch information
jamesroseman committed Jun 12, 2024
1 parent 8a64641 commit 0bf4307
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdks/python/apache_beam/utils/subprocess_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ def _really_stop_process(process_and_endpoint):
if process.poll() is not None:
break
logging.debug("Sending SIGINT to process")
process.send_signal(signal.SIGINT)
try:
process.send_signal(signal.SIGINT)
except ValueError:
# process.send_signal raises a ValueError on Windows.
process.terminate()
time.sleep(1)
if process.poll() is None:
process.kill()
Expand Down

0 comments on commit 0bf4307

Please sign in to comment.