mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix patch_updater.py to work on non-Windows platforms.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1690 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -5,14 +5,20 @@
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
|
||||
def exec_cmd(cmd, path):
|
||||
def exec_cmd(cmd, path, input_file=None):
|
||||
""" Execute the specified command and return the result. """
|
||||
out = ''
|
||||
err = ''
|
||||
parts = cmd.split()
|
||||
try:
|
||||
process = Popen(parts, cwd=path, stdout=PIPE, stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
if not input_file:
|
||||
process = Popen(parts, cwd=path, stdout=PIPE, stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
else:
|
||||
with open(input_file, 'rb') as f:
|
||||
process = Popen(parts, cwd=path, stdout=PIPE, stderr=PIPE,
|
||||
stdin=f,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate()
|
||||
except IOError, (errno, strerror):
|
||||
raise
|
||||
|
Reference in New Issue
Block a user