Changeset 643
- Timestamp:
- 06/12/05 22:29:06 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tea4cups/trunk/tea4cups
r641 r643 557 557 signal.signal(signal.SIGTERM, self.sigtermHandler) 558 558 serialize = self.isTrue(self.getPrintQueueOption(self.PrinterName, "serialize", ignore=1)) 559 self.pipes = { 0: (0, 1) }559 self.pipes = { 0: (0, 1) } 560 560 branches = self.enumBranches(self.PrinterName, "prehook") 561 561 for b in branches : 562 562 self.pipes[b.split("_", 1)[1]] = os.pipe() 563 563 retcode = self.runCommands("prehook", branches, serialize) 564 for p in self.pipes.items()[1:] :564 for p in [ (k, v) for (k, v) in self.pipes.items() if k != 0 ] : 565 565 os.close(p[1][1]) 566 566 if not self.isCancelled and not self.gotSigTerm : … … 572 572 if self.runCommands("posthook", branches, serialize) : 573 573 self.logInfo("An error occured during the execution of posthooks.", "warn") 574 for p in self.pipes.items()[1:] :574 for p in [ (k, v) for (k, v) in self.pipes.items() if k != 0 ] : 575 575 os.close(p[1][0]) 576 576 signal.signal(signal.SIGTERM, signal.SIG_IGN) … … 607 607 self.logDebug("Launching %s : %s" % (branch, command)) 608 608 btype, bname = branch.split("_", 1) 609 if bname not in self.pipes :609 if bname not in self.pipes.keys() : 610 610 bname = 0 611 611 if btype == "prehook" : … … 677 677 f.close() 678 678 try : 679 os.execve(originalbackend, arguments,os.environ)679 os.execve(originalbackend, arguments, os.environ) 680 680 except OSError, msg : 681 681 self.logDebug("execve() failed: %s" % msg) … … 693 693 status = os.WEXITSTATUS(status) 694 694 if status : 695 self.logInfo("CUPS backend %s returned %d." % (originalbackend, status), "error") 695 self.logInfo("CUPS backend %s returned %d." % (originalbackend,\ 696 status), "error") 696 697 return status 697 698 elif not killed : 698 self.logInfo("CUPS backend %s died abnormally." % originalbackend, "error") 699 self.logInfo("CUPS backend %s died abnormally." % originalbackend,\ 700 "error") 699 701 return -1 700 702 else : … … 726 728 for line in traceback.format_exception(*sys.exc_info()) : 727 729 lines.extend([l for l in line.split("\n") if l]) 728 msg = "ERROR: ".join(["%s (PID %s) : %s\n" % (wrapper.MyName, wrapper.pid, l) for l in (["ERROR: Tea4CUPS v%s" % version] + lines)]) 730 msg = "ERROR: ".join(["%s (PID %s) : %s\n" % (wrapper.MyName, \ 731 wrapper.pid, l) \ 732 for l in (["ERROR: Tea4CUPS v%s" % version] + lines)]) 729 733 sys.stderr.write(msg) 730 734 sys.stderr.flush()