This repository was archived by the owner on Mar 26, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ public static function updateCompletedPrintingJobs()
2020 if (self ::isDebugMode ()) {
2121 $ result = [0 ];
2222 } else {
23- $ result = exec ("lpstat -W completed -o " . config ('print.printer_name ' ) . " | awk '{print $1}' " , $ result );
23+ $ result = [];
24+ exec ("lpstat -W completed -o " . config ('print.printer_name ' ) . " | awk '{print $1}' " , $ result );
2425 }
2526 return $ result ;
2627 }
Original file line number Diff line number Diff line change @@ -218,9 +218,13 @@ public function cancelPrintJob($id) {
218218 /** Private helper functions */
219219
220220 private function updateCompletedPrintingJobs () {
221- $ result = Commands::updateCompletedPrintingJobs ();
222- Log::info ("Completed jobs: " . implode (', ' , $ result ));
223- PrintJob::whereIn ('job_id ' , $ result )->update (['state ' => PrintJob::SUCCESS ]);
221+ try {
222+ $ result = Commands::updateCompletedPrintingJobs ();
223+ Log::info ("Completed jobs: " . implode (', ' , $ result ));
224+ PrintJob::whereIn ('job_id ' , $ result )->update (['state ' => PrintJob::SUCCESS ]);
225+ } catch (\Exception $ e ) {
226+ Log::error ("Printing error at line: " . __FILE__ . ": " . __LINE__ . " (in function " . __FUNCTION__ . "). " . $ e ->getMessage ());
227+ }
224228 }
225229
226230 private function storeFile ($ file )
You can’t perform that action at this time.
0 commit comments