Use Popen.communicate() to avoid hang (Sascha Silbe) #397

This commit is contained in:
Tomeu Vizoso 2009-03-12 15:43:04 +01:00
parent 9bd24794c0
commit c4dce659a4

View File

@ -207,12 +207,13 @@ class SourcePackager(Packager):
def get_files(self): def get_files(self):
git_ls = subprocess.Popen('git-ls-files', stdout=subprocess.PIPE, git_ls = subprocess.Popen('git-ls-files', stdout=subprocess.PIPE,
cwd=self.config.source_dir) cwd=self.config.source_dir)
if git_ls.wait(): stdout, _ = git_ls.communicate()
if git_ls.returncode :
# Fall back to filtered list # Fall back to filtered list
return list_files(self.config.source_dir, return list_files(self.config.source_dir,
IGNORE_DIRS, IGNORE_FILES) IGNORE_DIRS, IGNORE_FILES)
return [path.strip() for path in git_ls.stdout.readlines()] return [path.strip() for path in '\n'.split(stdout)]
def package(self): def package(self):
tar = tarfile.open(self.package_path, 'w:bz2') tar = tarfile.open(self.package_path, 'w:bz2')