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

Unified Diff: sitescripts/extensions/bin/updateRecommendations.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/extensions/bin/updateRecommendations.py
===================================================================
--- a/sitescripts/extensions/bin/updateRecommendations.py
+++ b/sitescripts/extensions/bin/updateRecommendations.py
@@ -20,19 +20,21 @@ from sitescripts.utils import get_config
from sitescripts.subscriptions.bin.processTemplate import writeSubscriptions
from tempfile import mkdtemp
from shutil import rmtree
def updateRecommendations():
repository = get_config().get('extensions', 'abp_repository')
tempdir = mkdtemp(prefix='adblockplus')
try:
- subprocess.Popen(['hg', 'clone', '-U', repository, tempdir], stdout=subprocess.PIPE).communicate()
- subprocess.Popen(['hg', 'up', '-R', tempdir, '-r', 'default'], stdout=subprocess.PIPE).communicate()
+ subprocess.check_call(['hg', 'clone', '-q', '-U', repository, tempdir])
+ subprocess.check_call(['hg', 'up', '-q', '-R', tempdir, '-r', 'default'])
writeSubscriptions('recommendations', os.path.join(tempdir, 'chrome', 'content', 'ui', 'subscriptions.xml'))
- subprocess.Popen(['hg', 'commit', '-R', tempdir, '-u', 'hgbot', '-m', 'Updated list of recommended subscriptions'], stdout=subprocess.PIPE).communicate()
- subprocess.Popen(['hg', 'push', '-R', tempdir], stdout=subprocess.PIPE).communicate()
+ subprocess.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot', '-m', 'Updated list of recommended subscriptions'])
+
+ # Don't check the result of this call, it will be 1 if nothing needs pushing
+ subprocess.call(['hg', 'push', '-q', '-R', tempdir])
finally:
rmtree(tempdir)
if __name__ == '__main__':
setupStderr()
updateRecommendations()

Powered by Google App Engine
This is Rietveld