Index: tea4cups =================================================================== --- tea4cups (revision 3512) +++ tea4cups (working copy) @@ -1293,7 +1293,9 @@ retcode = self.runCommands("prehook", branches, serialize) for p in [ (k, v) for (k, v) in self.pipes.items() if k != 0 ] : os.close(p[1][1]) - if not self.isCancelled : + if self.isCancelled : + retcode = 5 # Job cancelled, for CUPS. + elif not retcode : if self.RealBackend : retcode = self.launchOriginalBackend() if retcode : @@ -1307,8 +1309,6 @@ branches = self.enumBranches(self.PrinterName, "posthook") if self.runCommands("posthook", branches, serialize) : self.logInfo("An error occured during the execution of posthooks.", "warn") - else : - retcode = 5 # Job cancelled, for CUPS. for p in [ (k, v) for (k, v) in self.pipes.items() if k != 0 ] : os.close(p[1][0]) if not retcode : @@ -1366,6 +1366,10 @@ if (btype == "prehook") and (retcode == 255) : # -1 self.logInfo("Job %s cancelled by prehook %s" % (self.JobId, branch)) self.isCancelled = 1 + elif (btype == "prehook") and (retcode == 254) : # -2 + self.logInfo("Job %s hook processing stopped by prehook %s" % (self.JobId, branch)) + exitcode = 1 + break else : self.logInfo("%s %s on printer %s didn't exit successfully." % (btypetitle, branch, self.PrinterName), "error") exitcode = 1