]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/Shell.php
Merge pull request #2337 from mogita/fix/invalid-query-string
[nominatim.git] / lib-php / Shell.php
index 72f90735e9763e798cb354155e8b077b37666f7e..b43db135c95ada03aa61b4a677cc0d560fb080e1 100644 (file)
@@ -48,7 +48,7 @@ class Shell
         return join(' ', $aEscaped);
     }
 
-    public function run()
+    public function run($bExitOnFail = false)
     {
         $sCmd = $this->escapedCmd();
         // $aEnv does not need escaping, proc_open seems to handle it fine
@@ -67,6 +67,11 @@ class Shell
         fclose($aPipes[0]); // no stdin
 
         $iStat = proc_close($hProc);
+
+        if ($iStat != 0 && $bExitOnFail) {
+            exit($iStat);
+        }
+
         return $iStat;
     }