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

Unified Diff: sitescripts/management/bin/installChanges.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/management/bin/installChanges.py
===================================================================
--- a/sitescripts/management/bin/installChanges.py
+++ b/sitescripts/management/bin/installChanges.py
@@ -31,17 +31,17 @@ def chown((uid, gid), dirname, names):
os.chown(os.path.join(dirname, name), uid, gid)
if (name.endswith('.fcgi') or name.endswith('.sh') or name.endswith('.pl')):
os.chmod(os.path.join(dirname, name), 0755)
def syncFiles(name, settings, syncState):
repo, path = splitRepositoryPath(settings['source'])
command = ['hg', 'log', '-R', repo, '-r', 'default', '--template', '{node|short}']
- currentRevision, dummy = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()
+ currentRevision = subprocess.check_output(command)
if not syncState.has_section(name):
syncState.add_section(name)
if syncState.has_option(name, 'latestRevision') and currentRevision == syncState.get(name, 'latestRevision'):
# Already up to date, nothing to do
return
tempdir = tempfile.mkdtemp(prefix=name)
@@ -50,17 +50,17 @@ def syncFiles(name, settings, syncState)
'-I', os.path.join(repo, path),
'-X', os.path.join(repo, '.hg_archival.txt'),
'-X', os.path.join(repo, '.hgtags'),
'-X', os.path.join(repo, '.hgignore'),
'-X', os.path.join(repo, '.hgsub'),
'-X', os.path.join(repo, '.hgsubstate'),
tempdir]
- subprocess.Popen(command, stdout=subprocess.PIPE).communicate()
+ subprocess.check_output(command)
srcdir = os.path.normpath(os.path.join(tempdir, path))
for relpath in settings['ignore']:
abspath = os.path.join(srcdir, relpath)
if os.path.commonprefix((abspath, srcdir)) == srcdir and os.path.exists(abspath):
shutil.rmtree(abspath)
if hasattr(os, 'chown') and settings['user'] and settings['group']:
from pwd import getpwnam
@@ -77,20 +77,20 @@ def syncFiles(name, settings, syncState)
if os.path.commonprefix((abspath, settings['target'])) == settings['target'] and os.path.lexists(abspath):
command.append('--exclude')
if os.path.isdir(abspath) and not os.path.islink(abspath):
command.append(os.path.join(relpath, ''))
else:
command.append(relpath)
command.append(os.path.join(srcdir, ''))
command.append(settings['target'])
- subprocess.Popen(command, stdout=subprocess.PIPE).communicate()
+ subprocess.check_output(command)
if settings['postsync']:
- subprocess.Popen(settings['postsync'], stdout=subprocess.PIPE, shell=True, cwd=settings['target']).communicate()
+ subprocess.check_output(settings['postsync'], shell=True, cwd=settings['target'])
syncState.set(name, 'latestRevision', currentRevision)
finally:
shutil.rmtree(tempdir, ignore_errors=True)
def readSyncSettings():
result = {}
for option in get_config().options('filesync'):

Powered by Google App Engine
This is Rietveld