Skip to content

Add error and signal handling #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"react-parallel/event-loop": "^1.0",
"react/event-loop": "^1.1",
"react/promise": "^2.7",
"wyrihaximus/constants": "^1.4.3"
"wyrihaximus/constants": "^1.4.3",
"wyrihaximus/parallel-runtime": "^1.0"
},
"require-dev": {
"wyrihaximus/async-test-utilities": "^3.2",
Expand Down
81 changes: 73 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

use Closure;
use parallel\Future;
use parallel\Runtime as ParallelRuntime;
use React\Promise\PromiseInterface;
use ReactParallel\EventLoop\EventLoopBridge;
use WyriHaximus\Parallel\Runtime as ParallelRuntime;

use function React\Promise\resolve;
use function var_export;

use const WyriHaximus\Constants\ComposerAutoloader\LOCATION;

Expand All @@ -36,9 +37,11 @@ public function __construct(EventLoopBridge $eventLoopBridge, string $autoload)
*/
public function run(Closure $callable, array $args = []): PromiseInterface
{
$future = $this->runtime->run($callable, $args); /** @phpstan-ignore-line */
$future = $this->runtime->run($callable, $args);
var_export($future);

if ($future instanceof Future) {
/** @psalm-suppress MissingClosureReturnType */
return $this->eventLoopBridge->await($future);
}

Expand Down