Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/Proxy/ProxyRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Aternos\Taskmaster\Communication\Socket\Exception\SocketWriteException;
use Aternos\Taskmaster\Communication\Socket\SelectableSocketInterface;
use Aternos\Taskmaster\Communication\Socket\SocketCommunicatorTrait;
use Aternos\Taskmaster\Communication\StdStreams;
use Aternos\Taskmaster\Runtime\AsyncRuntimeInterface;
use Aternos\Taskmaster\Taskmaster;
use Aternos\Taskmaster\Worker\Instance\ProxyableWorkerInstanceInterface;
Expand Down Expand Up @@ -244,7 +245,7 @@ protected function handleFail(null|string|Exception $reason = null): static
if ($reason instanceof Exception) {
$reason = $reason->getMessage();
}
fwrite(STDERR, "Proxy runtime failed: " . $reason . PHP_EOL);
fwrite(StdStreams::getInstance()->getStderr(), "Proxy runtime failed: " . $reason . PHP_EOL);
exit(1);
}
}
}
5 changes: 3 additions & 2 deletions src/Runtime/SocketRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Aternos\Taskmaster\Communication\Socket\Socket;
use Aternos\Taskmaster\Communication\Socket\SocketCommunicatorTrait;
use Aternos\Taskmaster\Communication\Socket\SocketInterface;
use Aternos\Taskmaster\Communication\StdStreams;
use Aternos\Taskmaster\Exception\PhpError;
use Aternos\Taskmaster\Exception\PhpFatalErrorException;
use Aternos\Taskmaster\Taskmaster;
Expand Down Expand Up @@ -102,7 +103,7 @@ protected function handleFail(null|string|Exception $reason = null): static
if ($reason instanceof Exception) {
$reason = $reason->getMessage();
}
fwrite(STDERR, "Runtime failed: " . $reason . PHP_EOL);
fwrite(StdStreams::getInstance()->getStderr(), "Runtime failed: " . $reason . PHP_EOL);
exit(1);
}
}
}
5 changes: 3 additions & 2 deletions src/Task/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Aternos\Taskmaster\Communication\Promise\TaskPromise;
use Aternos\Taskmaster\Communication\Request\ExecuteFunctionRequest;
use Aternos\Taskmaster\Communication\ResponseInterface;
use Aternos\Taskmaster\Communication\StdStreams;
use Aternos\Taskmaster\Exception\PhpError;
use Aternos\Taskmaster\Runtime\RuntimeInterface;
use Closure;
Expand Down Expand Up @@ -175,7 +176,7 @@ public function handleResult(mixed $result): void
public function handleError(Exception $error): void
{
$this->error = $error;
fwrite(STDERR, $error->getMessage() . PHP_EOL);
fwrite(StdStreams::getInstance()->getStderr(), $error->getMessage() . PHP_EOL);
}

/**
Expand Down Expand Up @@ -287,4 +288,4 @@ protected function isSync(): bool
{
return $this->sync;
}
}
}