Changeset 659 for tea4cups/trunk/tea4cups
- Timestamp:
- 09/29/05 00:45:28 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tea4cups/trunk/tea4cups
r655 r659 34 34 import ConfigParser 35 35 import signal 36 import popen2 36 37 from struct import pack, unpack 37 38 38 version = "3. 02_unofficial"39 version = "3.10_unofficial" 39 40 40 41 class TeeError(Exception): … … 623 624 else : 624 625 infile = sys.stdin 626 627 filtercommand = self.getPrintQueueOption(self.PrinterName, "filter", \ 628 ignore=1) 629 if filtercommand : 630 self.logDebug("Data stream will be filtered through [%s]" % filtercommand) 631 filteroutput = "%s.filteroutput" % self.DataFile 632 outf = open(filteroutput, "wb") 633 filterstatus = self.stdioRedirSystem(filtercommand, infile.fileno(), outf.fileno()) 634 outf.close() 635 self.logDebug("Filter's output status : %s" % repr(filterstatus)) 636 if mustclose : 637 infile.close() 638 infile = open(filteroutput, "rb") 639 mustclose = 1 640 else : 641 self.logDebug("Data stream will be used as-is (no filter defined)") 642 625 643 CHUNK = 64*1024 # read 64 Kb at a time 626 644 dummy = 0 … … 639 657 dummy += 1 640 658 outfile.close() 659 660 if filtercommand : 661 self.logDebug("Removing filter's output file %s" % filteroutput) 662 try : 663 os.remove(filteroutput) 664 except : 665 pass 666 641 667 if mustclose : 642 668 infile.close() 669 670 self.logDebug("%s bytes saved..." % sizeread) 643 671 self.JobSize = sizeread 644 672 self.JobMD5Sum = checksum.hexdigest() … … 672 700 if self.RealBackend : 673 701 retcode = self.runOriginalBackend() 702 if retcode : 703 onfail = self.getPrintQueueOption(self.PrinterName, \ 704 "onfail", ignore=1) 705 if onfail : 706 self.logDebug("Launching onfail script %s" % onfail) 707 os.system(onfail) 674 708 if not self.gotSigTerm : 675 709 os.environ["TEASTATUS"] = str(retcode)