Description: Fix the delete command
Author: Emmanuel Bouthenot <kolter@debian.org>
Forwarded: no
Last-Update: 2015-01-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/pmailq
+++ b/pmailq
@@ -20,7 +20,7 @@
 
 
 from optparse import OptionParser, OptionGroup # needs python >= 2.3
-import sys, os, subprocess, fcntl, select, fnmatch
+import sys, os, subprocess, fcntl, select, fnmatch, re
 
 class Proc:
 
@@ -209,10 +209,9 @@
                 for o in n['dest']:
                     e.append(o)
                 if self.check(m['size'], m['active'], m['hold'], e, i):
-                    proc = popen2.Popen3("%s %s" % (DELQ, m['id']), True)
-                    p_ret = proc.wait()
+                    p_ret, _, p_stderr = Proc().run('%s %s' % (DELQ, m['id']))
                     if p_ret != 0:
-                        print "deleting %s [FAILED] (%s)" % (m['id'], "".join(proc.childerr.readlines()).strip())
+                        print "deleting %s [FAILED] (%s)" % (m['id'], re.sub('\s+', ' ', p_stderr).strip())
                     else:
                         print "deleting %s [OK]" % m['id']
 
