mirror of
https://github.com/danog/parallel.git
synced 2024-11-27 04:44:56 +01:00
Skip cli_set_process_title inside phpdbg
This commit is contained in:
parent
39664d42d0
commit
4546ef8b1d
11
bin/worker
11
bin/worker
@ -4,7 +4,10 @@
|
|||||||
use Amp\Parallel\Sync;
|
use Amp\Parallel\Sync;
|
||||||
use Amp\Parallel\Worker;
|
use Amp\Parallel\Worker;
|
||||||
|
|
||||||
@cli_set_process_title('amp-worker');
|
// Doesn't exist in phpdbg...
|
||||||
|
if (\function_exists('cli_set_process_title')) {
|
||||||
|
@cli_set_process_title('amp-worker');
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect all output written using echo, print, printf, etc. to STDERR.
|
// Redirect all output written using echo, print, printf, etc. to STDERR.
|
||||||
ob_start(function ($data) {
|
ob_start(function ($data) {
|
||||||
@ -17,7 +20,7 @@ ob_start(function ($data) {
|
|||||||
dirname(__DIR__, 3) . '/autoload.php',
|
dirname(__DIR__, 3) . '/autoload.php',
|
||||||
dirname(__DIR__) . '/vendor/autoload.php',
|
dirname(__DIR__) . '/vendor/autoload.php',
|
||||||
];
|
];
|
||||||
|
|
||||||
$autoloadPath = null;
|
$autoloadPath = null;
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
@ -25,12 +28,12 @@ ob_start(function ($data) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($autoloadPath === null) {
|
if ($autoloadPath === null) {
|
||||||
fwrite(STDERR, 'Could not locate autoload.php.');
|
fwrite(STDERR, 'Could not locate autoload.php.');
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require $autoloadPath;
|
require $autoloadPath;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -46,10 +46,11 @@ class ChannelParser extends Parser {
|
|||||||
*/
|
*/
|
||||||
private static function parser(callable $callback, callable $errorHandler): \Generator {
|
private static function parser(callable $callback, callable $errorHandler): \Generator {
|
||||||
while (true) {
|
while (true) {
|
||||||
$data = \unpack("Cprefix/Llength", yield self::HEADER_LENGTH);
|
$header = yield self::HEADER_LENGTH;
|
||||||
|
$data = \unpack("Cprefix/Llength", $header);
|
||||||
|
|
||||||
if ($data["prefix"] !== 0) {
|
if ($data["prefix"] !== 0) {
|
||||||
throw new ChannelException("Invalid header received");
|
throw new ChannelException("Invalid header received: " . \bin2hex($header));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = yield $data["length"];
|
$data = yield $data["length"];
|
||||||
|
Loading…
Reference in New Issue
Block a user