Преглед изворни кода

Fix typos in manpage
Fix exit code on errors (http://bugs.debian.org/457299)

Emmanuel Bouthenot пре 16 година
родитељ
комит
1018c28bab
2 измењених фајлова са 7 додато и 7 уклоњено
  1. 5 5
      pmailq
  2. 2 2
      pmailq.pod

+ 5 - 5
pmailq

@@ -44,17 +44,17 @@ class mailqueue:
     def parse(self):
     def parse(self):
         
         
         proc = popen2.Popen3(MAILQ, True)    
         proc = popen2.Popen3(MAILQ, True)    
-        
+
+        # mail system down ?
         p_ret = proc.wait()
         p_ret = proc.wait()
         if p_ret != 0:
         if p_ret != 0:
-            print "ERROR (%d) !!!:" % p_ret
-            print "".join(proc.childerr.readline())
-            return None
+            sys.stderr.write ("ERR : %s\n" % "".join(proc.childerr.readline()).strip())
+            sys.exit (-1)
 
 
         # checking empty mail queue
         # checking empty mail queue
         buffer = proc.fromchild.readlines()
         buffer = proc.fromchild.readlines()
         if len(buffer)>0 and buffer[0].strip() == "Mail queue is empty":
         if len(buffer)>0 and buffer[0].strip() == "Mail queue is empty":
-            print buffer[0].strip()
+            sys.stderr.write ("INFO : %s\n" % buffer[0].strip())
             return None
             return None
         
         
         # skip first and last line
         # skip first and last line

+ 2 - 2
pmailq.pod

@@ -10,8 +10,8 @@ pmailq B<--help>
 
 
 =head1 DESCRIPTION
 =head1 DESCRIPTION
 
 
-pmailq parse output of B<mailq> command from postfix (ie: I<postqueue -p>) and permits
-to perform some actions (like removing or displaying in a machine readable format) in
+pmailq parses output of B<mailq> command from postfix (ie: I<postqueue -p>) and permits
+to perform some actions (like removing or displaying in a machine readable format) on
 a bunch of entries in queue, selected by applying patterns on criterias like email
 a bunch of entries in queue, selected by applying patterns on criterias like email
 address, error message from smtp server, message size, mail status in queue.
 address, error message from smtp server, message size, mail status in queue.