-
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
I'm not sure if this is a bug or intentional. Could you help me figure it out please?
The cancellation parameter isn't described in PHPDOC, but I assume it's intended to cancel the startup procedure, not the process itself.
The behavior is different on Linux and Windows. Which is confusing.
Here is a test script to demonstrate the issue.
<?php
include_once __DIR__.'/vendor/autoload.php';
use Amp\Process\Process;
use Amp\TimeoutCancellation;
use function Amp\delay;
$cmd = PHP_OS_FAMILY === 'Windows' ? 'ping -n 100 127.0.0.1' : 'sleep 100';
echo PHP_OS_FAMILY.', php '.PHP_VERSION."\n";
echo $cmd."\n";
$process = Process::start($cmd, cancellation: new TimeoutCancellation(3, "Startup timeout"));
echo $process->isRunning() ? "running\n" : "stopped\n";
foreach (range(1, 5) as $x) {
delay(1);
echo $process->isRunning() ? "running\n" : "stopped\n";
}
$process->kill();
Windows
Windows, php 8.3.14
ping -n 100 127.0.0.1
running
running
running
stopped
stopped
stopped
Linux
Linux, php 8.3.27
sleep 100
running
running
running
running
running
running
Metadata
Metadata
Assignees
Labels
No labels