1
0
mirror of https://github.com/danog/PrimeModule.git synced 2024-11-26 20:34:37 +01:00
This commit is contained in:
Daniil Gentili 2018-03-13 14:46:26 +01:00
parent a966030727
commit 1a1c52780b

View File

@ -80,8 +80,8 @@ class PrimeModule
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);
@ -114,8 +114,8 @@ class PrimeModule
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);