From: Chris Lamb Date: Tue, 27 Oct 2009 16:26:26 +0000 (+0000) Subject: Monkeypatch commands.getstatusoutput to work around Python Popen issue. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33da72f6ad1a071d17394aed1509fdfde6e38534;p=dak Monkeypatch commands.getstatusoutput to work around Python Popen issue. Signed-off-by: Chris Lamb --- diff --git a/daklib/utils.py b/daklib/utils.py index 6e363266..40410fbb 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -39,6 +39,7 @@ import time import re import string import email as modemail +import subprocess from dbconn import DBConn, get_architecture, get_component, get_suite from dak_exceptions import * @@ -63,6 +64,20 @@ key_uid_email_cache = {} #: Cache for email addresses from gpg key uids known_hashes = [("sha1", apt_pkg.sha1sum, (1, 8)), ("sha256", apt_pkg.sha256sum, (1, 8))] #: hashes we accept for entries in .changes/.dsc +import commands +def dak_getstatusoutput(cmd): + pipe = subprocess.Popen(cmd, shell=True, universal_newlines=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + output = str.join("", pipe.stdout.readlines()) + + ret = pipe.wait() + if ret is None: + ret = 0 + + return ret, output +commands.getstatusoutput = dak_getstatusoutput + ################################################################################ def html_escape(s):