Commit 651071c2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

improve Popen usage in get_installed_files.

parent 2636c6f9
......@@ -174,21 +174,21 @@ class Recipe(object):
# Exclude directory and don't follow link.
assert self.buildout_prefix
log = logging.getLogger(self.name)
cmd = 'find %s -cnewer %s ! -type d' % (self.buildout_prefix, ref_file)
args = ['find', self.buildout_prefix, '-cnewer', ref_file, '!', '-type', 'd']
try:
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
files, _i_ = p.communicate()
p = subprocess.Popen(args, stdout=subprocess.PIPE)
files, _ = p.communicate()
retcode = p.returncode
if retcode < 0:
log.error('Command received signal %s: %s' % (-retcode, cmd))
log.error('Command received signal %s: %s' % (-retcode, args))
raise zc.buildout.UserError('System error')
elif retcode > 0:
log.error('Command failed with exit code %s: %s' % (retcode, cmd))
log.error('Command failed with exit code %s: %s' % (retcode, args))
raise zc.buildout.UserError('System error')
except OSError, e:
log.error('Command failed: %s: %s' % (e, cmd))
log.error('Command failed: %s: %s' % (e, args))
raise zc.buildout.UserError('System error')
return files.split()
return files.splitlines()
def check_promises(self, log=None):
result = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment