if not path or os.path.exists(path):
return
- parent = os.path.dirname(path)
+ parent = os.path.dirname(path)
if parent != path:
mkdir_p(parent)
# Close extra file handles on UNIX (on Windows this cannot be done while
# also redirecting input).
kUseCloseFDs = not (platform.system() == 'Windows')
-def executeCommand(command, cwd=None, env=None):
+def executeCommand(command, cwd=None, env=None, input=None):
p = subprocess.Popen(command, cwd=cwd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env, close_fds=kUseCloseFDs)
- out,err = p.communicate()
+ out,err = p.communicate(input=input)
exitCode = p.wait()
# Detect Ctrl-C in subprocess.