diff -up hplip-1.6.7/hpssd.py.subprocess-replacement hplip-1.6.7/hpssd.py --- hplip-1.6.7/hpssd.py.subprocess-replacement 2007-10-08 16:53:46.000000000 +0100 +++ hplip-1.6.7/hpssd.py 2007-10-08 16:58:04.000000000 +0100 @@ -53,7 +53,7 @@ __doc__ = "Provides various services to # Std Lib import sys, socket, os, os.path, signal, getopt, glob, time, select -import popen2, threading, gettext, re, xml.parsers.expat, fcntl +import subprocess, threading, gettext, re, xml.parsers.expat, fcntl import cStringIO, pwd from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ @@ -1331,21 +1331,23 @@ class MailThread(threading.Thread): if sendmail: sendmail = os.path.join(sendmail, 'sendmail') - sendmail += ' -t -r %s' % self.from_address + cmd = [sendmail,'-t','-r',self.from_address] - log.debug(sendmail) - std_out, std_in, std_err = popen2.popen3(sendmail) - log.debug(repr(self.message)) - std_in.write(self.message) - std_in.close() - - r, w, e = select.select([std_err], [], [], 2.0) - - if r: - err = std_err.read() - if err: - log.error(repr(err)) - self.result = ERROR_TEST_EMAIL_FAILED + log.debug(repr(cmd)) + err = None + try: + sp = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + std_out, std_err = sp.communicate(self.message) + log.debug(repr(self.message)) + if std_err != '': + err = std_err + + except OSError, e: + err = str(e) + + if err: + log.error(repr(err)) + self.result = ERROR_TEST_EMAIL_FAILED else: log.error("Mail send failed. sendmail not found.")