File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,8 +212,17 @@ def _run_gdb(self):
212212 utils .die ('Port 1234 is already in use, is QEMU running?' )
213213
214214 utils .green ('Starting QEMU with gdb connection on port 1234...' )
215- with subprocess .Popen (qemu_cmd ,
216- preexec_fn = os .setpgrp ) as qemu_proc :
215+ # setpgrp() is equivalent to setpgid(0, 0). The 'process_group'
216+ # keyword argument is equivalent to calling setpgid(0, arg) but it
217+ # is only available in Python 3.11 and newer.
218+ if sys .version_info >= (3 , 11 , 0 ):
219+ popen_kwargs = {'process_group' : 0 }
220+ else :
221+ popen_kwargs = {'preexec_fn' : os .setpgrp }
222+ # pylint seems to think process_group will be used with Python 3.10
223+ # and earlier?
224+ # pylint: disable-next=unexpected-keyword-arg
225+ with subprocess .Popen (qemu_cmd , ** popen_kwargs ) as qemu_proc :
217226 utils .green (f"Starting { self .gdb_bin } ..." )
218227 with subprocess .Popen (gdb_cmd ) as gdb_proc , \
219228 contextlib .suppress (KeyboardInterrupt ):
You can’t perform that action at this time.
0 commit comments