File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 20
20
import shutil
21
21
import stat
22
22
import subprocess
23
+ import sys
23
24
import tempfile
24
25
import time
25
26
from subprocess import CalledProcessError
@@ -126,16 +127,21 @@ def __init__(
126
127
self ._start_time = time .time ()
127
128
self ._logfile = self ._rotate_and_get_next_logfile ()
128
129
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
+
129
136
with open (self ._logfile , "w" , encoding = "utf-8" ) as logfile_fp :
130
137
# 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
133
139
casd_args ,
134
140
cwd = path ,
135
141
stdout = logfile_fp ,
136
142
stderr = subprocess .STDOUT ,
137
- preexec_fn = os .setpgrp ,
138
143
env = self .__buildbox_casd_env (),
144
+ ** process_group_kwargs
139
145
)
140
146
141
147
self ._casd_channel = None
You can’t perform that action at this time.
0 commit comments