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

Unified Diff: sitescripts/subscriptions/bin/updateSubscriptionDownloadsCVS.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/bin/updateSubscriptionDownloadsCVS.py
===================================================================
--- a/sitescripts/subscriptions/bin/updateSubscriptionDownloadsCVS.py
+++ b/sitescripts/subscriptions/bin/updateSubscriptionDownloadsCVS.py
@@ -22,21 +22,21 @@ if __name__ == '__main__':
setupStderr()
source = get_config().get('subscriptionDownloads', 'outdir')
cvsroot = get_config().get('subscriptionDownloads', 'cvsroot')
cvsdir = get_config().get('subscriptionDownloads', 'cvsdir')
dest = tempfile.mkdtemp()
try:
os.chdir(os.path.dirname(dest)) # Yes, CVS sucks
- subprocess.Popen(['cvs', '-Q', '-d', cvsroot, 'checkout', '-d', os.path.basename(dest), cvsdir]).communicate()
+ subprocess.check_call(['cvs', '-Q', '-d', cvsroot, 'checkout', '-d', os.path.basename(dest), cvsdir])
os.chdir(dest)
- (result, dummy) = subprocess.Popen(['rsync', '-a', '--delete', '--out-format=%o %n', '--exclude=CVS', source + '/', dest], stdout=subprocess.PIPE).communicate()
+ result = subprocess.check_output(['rsync', '-a', '--delete', '--out-format=%o %n', '--exclude=CVS', source + '/', dest])
Sebastian Noack 2013/07/04 13:57:51 There is no need to hard-code path separators. Use
for line in result.split('\n'):
match = re.search(r'^(\S+)\s+(.*)', line)
if match and match.group(1) == 'send':
- subprocess.Popen(['cvs', '-Q', 'add', match.group(2)]).communicate()
+ subprocess.check_call(['cvs', '-Q', 'add', match.group(2)])
elif match and match.group(1) == 'del.':
- subprocess.Popen(['cvs', '-Q', 'remove', match.group(2)]).communicate()
- subprocess.Popen(['cvs', '-Q', 'commit', '-m', 'Uploading subscription updates'], stdout=subprocess.PIPE).communicate()
+ subprocess.check_call(['cvs', '-Q', 'remove', match.group(2)])
+ subprocess.check_call(['cvs', '-Q', 'commit', '-m', 'Uploading subscription updates'])
finally:
if os.path.exists(dest):
shutil.rmtree(dest, True)

Powered by Google App Engine
This is Rietveld