File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2020import shutil
2121import stat
2222import subprocess
23+ import sys
2324import tempfile
2425import time
2526from subprocess import CalledProcessError
@@ -126,16 +127,21 @@ def __init__(
126127 self ._start_time = time .time ()
127128 self ._logfile = self ._rotate_and_get_next_logfile ()
128129
130+ # Create a new process group for buildbox-casd such that SIGINT won't reach it.
131+ if sys .version_info >= (3 , 11 ):
132+ process_group_kwargs = {"process_group" : 0 }
133+ else :
134+ process_group_kwargs = {"preexec_fn" : os .setpgrp }
135+
129136 with open (self ._logfile , "w" , encoding = "utf-8" ) as logfile_fp :
130137 # The frontend will take care of terminating buildbox-casd.
131- # Create a new process group for it such that SIGINT won't reach it.
132- self .process = subprocess .Popen ( # pylint: disable=consider-using-with, subprocess-popen-preexec-fn
138+ self .process = subprocess .Popen ( # pylint: disable=consider-using-with
133139 casd_args ,
134140 cwd = path ,
135141 stdout = logfile_fp ,
136142 stderr = subprocess .STDOUT ,
137- preexec_fn = os .setpgrp ,
138143 env = self .__buildbox_casd_env (),
144+ ** process_group_kwargs
139145 )
140146
141147 self ._casd_channel = None
You can’t perform that action at this time.
0 commit comments