Do not even try using parallel processing if not running in CLI
This commit is contained in:
parent
d0829a6f96
commit
495e543238
4
phar.php
4
phar.php
@ -10,8 +10,8 @@ if (PHP_MAJOR_VERSION === 5) {
|
|||||||
echo "**********************************************************************$newline$newline";
|
echo "**********************************************************************$newline$newline";
|
||||||
echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7$newline";
|
echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7$newline";
|
||||||
echo "PHP 5 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline";
|
echo "PHP 5 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline";
|
||||||
echo "RECOMMENDED VERSION: PHP 7.3$newline";
|
echo "SUPPORTED VERSIONS: PHP 7.0, 7.1, 7.2, 7.3+$newline";
|
||||||
echo "ALL PHP 7 VERSIONS (7.0, 7.1, 7.2, 7.3) ARE SUPPORTED$newline$newline";
|
echo "RECOMMENDED VERSION: PHP 7.3$newline$newline";
|
||||||
echo "**********************************************************************$newline";
|
echo "**********************************************************************$newline";
|
||||||
echo "**********************************************************************$newline";
|
echo "**********************************************************************$newline";
|
||||||
unset($newline);
|
unset($newline);
|
||||||
|
@ -94,23 +94,24 @@ class Magic
|
|||||||
self::$revision = 'Revision: '.self::$revision.$latest;
|
self::$revision = 'Revision: '.self::$revision.$latest;
|
||||||
}
|
}
|
||||||
self::$can_parallel = false;
|
self::$can_parallel = false;
|
||||||
|
if (php_sapi_name() === 'cli') {
|
||||||
try {
|
try {
|
||||||
$back = debug_backtrace(0);
|
$back = debug_backtrace(0);
|
||||||
$promise = \Amp\File\get(end($back)['file']);
|
$promise = \Amp\File\get(end($back)['file']);
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
if (wait($promise)) {
|
if (wait($promise)) {
|
||||||
self::$can_parallel = true;
|
self::$can_parallel = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
if ($e->getMessage() !== 'Loop stopped without resolving the promise') {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} while (true);
|
||||||
if ($e->getMessage() !== 'Loop stopped without resolving the promise') {
|
} catch (\Throwable $e) {
|
||||||
throw $e;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (true);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
}
|
}
|
||||||
if (!self::$can_parallel && !defined('AMP_WORKER')) {
|
if (!self::$can_parallel && !defined('AMP_WORKER')) {
|
||||||
define('AMP_WORKER', 1);
|
define('AMP_WORKER', 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user