Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Mar 13, 2018
1 parent a966030 commit 1a1c527
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/danog/PrimeModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public static function native($what)
public static function python_single($what)
{
if (function_exists('shell_exec')) {
$res = shell_exec('timeout 10 python '.__DIR__.'/prime.py '.$what);
if ($res == '' || is_null($res)) {
$res = trim(shell_exec('timeout 10 python '.__DIR__.'/prime.py '.$what.' 2>&1'));
if ($res == '' || is_null($res) || !is_numeric($res)) {
return false;
}
$newval = intval($res);
Expand Down Expand Up @@ -114,8 +114,8 @@ public static function python($what)
public static function python_single_alt($what)
{
if (function_exists('shell_exec')) {
$res = shell_exec('python '.__DIR__.'/alt_prime.py '.$what);
if ($res == '' || is_null($res)) {
$res = trim(shell_exec('python '.__DIR__.'/alt_prime.py '.$what.' 2>&1'));
if ($res == '' || is_null($res) || !is_numeric($res)) {
return false;
}
$newval = intval($res);
Expand Down

0 comments on commit 1a1c527

Please sign in to comment.