mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
subprocess: Use getfullargspec on python3
This commit is contained in:
parent
59582ca06e
commit
798a36c2d8
@ -15,6 +15,7 @@ from __future__ import absolute_import
|
||||
import inspect
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from subprocess import PIPE, STDOUT, CalledProcessError
|
||||
|
||||
@ -25,8 +26,12 @@ __all__ = ['Popen', 'call', 'check_call', 'check_output', 'CalledProcessError',
|
||||
class Popen(subprocess.Popen):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs.setdefault('close_fds', True)
|
||||
if sys.version_info[0] >= 3:
|
||||
getargs = inspect.getfullargspec
|
||||
else:
|
||||
getargs = inspect.getargspec
|
||||
|
||||
if 'restore_signals' not in inspect.getargspec(subprocess.Popen.__init__)[0]:
|
||||
if 'restore_signals' not in getargs(subprocess.Popen.__init__)[0]:
|
||||
given_preexec_fn = kwargs.pop('preexec_fn', None)
|
||||
restore_signals = kwargs.pop('restore_signals', True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user