diff options
author | Richard Lowe <richlowe@richlowe.net> | 2012-07-24 03:56:16 +0000 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2012-07-24 03:56:16 +0000 |
commit | ff50e8e5ae1af23788a33c5296dd2009f3b8baf7 (patch) | |
tree | 2be87e5a4ed21edd5657f30b109815e6adb863a3 /usr/src/tools/scripts/git-pbchk.py | |
parent | afb25078f70983c5c6b030be78ebcda3b2d8e79c (diff) | |
download | illumos-gate-ff50e8e5ae1af23788a33c5296dd2009f3b8baf7.tar.gz |
2599 git-pbchk suffers classic pipe deadlock
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/tools/scripts/git-pbchk.py')
-rw-r--r-- | usr/src/tools/scripts/git-pbchk.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py index 59af2f3832..74be6a4818 100644 --- a/usr/src/tools/scripts/git-pbchk.py +++ b/usr/src/tools/scripts/git-pbchk.py @@ -24,6 +24,7 @@ import os import re import subprocess import sys +import tempfile from cStringIO import StringIO @@ -62,15 +63,24 @@ def git(command): command = ["git"] + command - p = subprocess.Popen(command, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + try: + tmpfile = tempfile.TemporaryFile(prefix="git-nits") + except EnvironmentError, e: + raise GitError("Could not create temporary file: %s\n" % e) + + try: + p = subprocess.Popen(command, + stdout=tmpfile, + stderr=subprocess.STDOUT) + except OSError, e: + raise GitError("could not execute %s: %s\n" (command, e)) err = p.wait() if err != 0: raise GitError(p.stdout.read()) - return p.stdout + tmpfile.seek(0) + return tmpfile def git_root(): |