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 "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 "RECOMMENDED VERSION: PHP 7.3$newline";
|
||||
echo "ALL PHP 7 VERSIONS (7.0, 7.1, 7.2, 7.3) ARE SUPPORTED$newline$newline";
|
||||
echo "SUPPORTED VERSIONS: PHP 7.0, 7.1, 7.2, 7.3+$newline";
|
||||
echo "RECOMMENDED VERSION: PHP 7.3$newline$newline";
|
||||
echo "**********************************************************************$newline";
|
||||
echo "**********************************************************************$newline";
|
||||
unset($newline);
|
||||
|
@ -94,23 +94,24 @@ class Magic
|
||||
self::$revision = 'Revision: '.self::$revision.$latest;
|
||||
}
|
||||
self::$can_parallel = false;
|
||||
|
||||
try {
|
||||
$back = debug_backtrace(0);
|
||||
$promise = \Amp\File\get(end($back)['file']);
|
||||
do {
|
||||
try {
|
||||
if (wait($promise)) {
|
||||
self::$can_parallel = true;
|
||||
break;
|
||||
if (php_sapi_name() === 'cli') {
|
||||
try {
|
||||
$back = debug_backtrace(0);
|
||||
$promise = \Amp\File\get(end($back)['file']);
|
||||
do {
|
||||
try {
|
||||
if (wait($promise)) {
|
||||
self::$can_parallel = true;
|
||||
break;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
if ($e->getMessage() !== 'Loop stopped without resolving the promise') {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
if ($e->getMessage() !== 'Loop stopped without resolving the promise') {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
} catch (\Throwable $e) {
|
||||
} while (true);
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
}
|
||||
if (!self::$can_parallel && !defined('AMP_WORKER')) {
|
||||
define('AMP_WORKER', 1);
|
||||
|
Loading…
Reference in New Issue
Block a user