Work around cutycapt wait-timeout exit code bug
[phancap.git] / src / phancap / Adapter / Cutycapt.php
index 13f972e22c8c3511d7a780f06cd131ae71acc536..a757b07929d1d3def39b5c9913146c141370a929 100644 (file)
@@ -117,6 +117,11 @@ class Adapter_Cutycapt
         // we kill it if it does not exit itself
         Executor::runForSomeTime($xvfbcmd . ' ' . $cmd, $maxWaitTime);
 
         // we kill it if it does not exit itself
         Executor::runForSomeTime($xvfbcmd . ' ' . $cmd, $maxWaitTime);
 
+        //cutycapt does not report timeouts via exit status
+        if (!file_exists($tmpPath)) {
+            throw new \Exception('Error running cutycapt (wait timeout)', 1);
+        }
+
         $this->resize($tmpPath, $img, $options);
     }
 
         $this->resize($tmpPath, $img, $options);
     }