Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/subscriptions/combineSubscriptions.py

Issue 10942098: Make sure subprocess calls don`t ignore result codes indicating errors. Fix JS docs generation whil… (Closed)
Patch Set: Fixed wrong argument format Created July 4, 2013, 1:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/subscriptions/combineSubscriptions.py
===================================================================
--- a/sitescripts/subscriptions/combineSubscriptions.py
+++ b/sitescripts/subscriptions/combineSubscriptions.py
@@ -82,17 +82,17 @@ def conditionalWrite(filePath, data):
newData = re.sub(r'\s*\d+ \w+ \d+ \d+:\d+ UTC', '', newData)
if oldData == newData:
changed = False
if changed:
handle = codecs.open(filePath, 'wb', encoding='utf-8')
handle.write(data)
handle.close()
try:
- subprocess.Popen(['7za', 'a', '-tgzip', '-mx=9', '-bd', '-mpass=15', filePath + '.gz', filePath], stdout=subprocess.PIPE).communicate()
+ subprocess.check_output(['7za', 'a', '-tgzip', '-mx=9', '-bd', '-mpass=15', filePath + '.gz', filePath])
except:
print >>sys.stderr, 'Failed to compress file %s. Please ensure that p7zip is installed on the system.' % filePath
def processVerbatimFile(sourceDir, targetDir, file):
handle = codecs.open(os.path.join(sourceDir, file), 'rb', encoding='utf-8')
conditionalWrite(os.path.join(targetDir, file), handle.read())
handle.close()
@@ -324,11 +324,11 @@ if __name__ == '__main__':
if option in ('-h', '--help'):
usage()
sys.exit()
elif option in ('-t', '--timeout'):
timeout = int(value)
if os.path.exists(os.path.join(sourceDir, '.hg')):
# Our source is a Mercurial repository, try updating
- subprocess.Popen(['hg', '-R', sourceDir, 'pull', '--update']).communicate()
+ subprocess.check_call(['hg', '-q', '-R', sourceDir, 'pull', '--update'])
combineSubscriptions(sourceDir, targetDir, timeout)

Powered by Google App Engine
This is Rietveld