Forwarding args for SafePopen to Popen directly

This commit is contained in:
Strahinja Val Markovic 2013-12-24 18:53:23 -08:00
parent 7fac081bea
commit b3f70a6c95

View File

@ -171,17 +171,13 @@ def ForceSemanticCompletion( request_data ):
return ( 'force_semantic' in request_data and
bool( request_data[ 'force_semantic' ] ) )
def SafePopen( args, bufsize = 0, executable = None, stdin = None,
stdout = None, stderr = None, preexec_fn = None,
close_fds = False, shell = False, cwd = None, env = None,
universal_newlines = False, startupinfo = None,
creationflags = 0 ):
if stdin is None:
# A wrapper for subprocess.Popen that works around a Popen bug on Windows.
def SafePopen( *args, **kwargs ):
if kwargs.get( 'stdin', '' ) is None:
# We need this on Windows otherwise bad things happen. See issue #637.
stdin = subprocess.PIPE if OnWindows() else None
kwargs[ 'stdin' ] = subprocess.PIPE if OnWindows() else None
return subprocess.Popen( args, bufsize, executable, stdin, stdout, stderr,
preexec_fn, close_fds, shell, cwd, env,
universal_newlines, startupinfo, creationflags )
return subprocess.Popen( *args, **kwargs )