-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
posix_kill for windows #152
Comments
I work on Windows with XAMPP. Does that mean that I cannot use this library? |
i develop on my windows machine with wsl |
Dear contributor, because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it. |
@ttodua To get this working on Windows without even messing with These are the main changes I made from PR to get working on Windows. // Pool.php protected static $pcntl = null;
public static function isSupported(): bool
{
if (\is_null(self::$pcntl))
self::$pcntl = function_exists('pcntl_async_signals')
&& function_exists('posix_kill')
&& !self::$forceSynchronous;
return self::$pcntl;
}
public function wait(?callable $intermediateCallback = null): array
{
while ($this->inProgress) {
foreach ($this->inProgress as $process) {
if ($process->getCurrentExecutionTime() > $this->timeout) {
$this->markAsTimedOut($process);
}
//if ($process instanceof SynchronousProcess) {
// $this->markAsFinished($process);
//}
if (!self::$pcntl) {
if ($process->isSuccessful()) {
$this->markAsFinished($process);
} elseif (! $process->isRunning() && $process->isTerminated()) {
$this->markAsFailed($process);
}
}
}
if (! $this->inProgress) {
break;
}
if ($intermediateCallback) {
call_user_func_array($intermediateCallback, [$this]);
}
usleep($this->sleepTime);
}
return $this->results;
} // ParentRuntime.php public static function createProcess($task, ?int $outputLength = null, ?string $binary = 'php'): Runnable
{
if (! self::$isInitialised) {
self::init();
}
//if (! Pool::isSupported()) {
// return SynchronousProcess::create($task, self::getId());
//}
$process = new Process([
$binary,
self::$childProcessScript,
self::$autoloader,
self::encodeTask($task),
$outputLength,
]);
return ParallelProcess::create($process, self::getId());
} // ParallelProcess.php public function stop($timeout = 0): self
{
$this->process->stop($timeout); // defaults to SIGKILL = 9
return $this;
} This will resolve issue #157 too. |
…iginal author's `spatie/async` package. - Some these changes was part of previous PR fork spatie/async#56, others fix or address many issues raised in: spatie/async#168, spatie/async#147, spatie/async#162, spatie/async#164, spatie/async#168, spatie/async#160, spatie/async#153, spatie/async#152, spatie/async#157, spatie/async#134, spatie/async#76, spatie/async#107, spatie/async#98, spatie/async#4.
Hi.
library's
isSupported()
static method checks whether spatie-async is supported on system. Windows misses some requirements, and one of them isposix_kill
function. Is is possible to be a support for windows too, using this replacement method forposix_kill
? (though, main problem still stayspcntl_async_signals
...)Do you have an idea, why on ubuntu 20.04 (even though pcntl module is loaded and neither it is in disabled functions) it shows
Uncaught Error: Call to undefined function pcntl_async_signals()
when calling the function (just for testing purposes)The text was updated successfully, but these errors were encountered: