Skip to content

proc_close after proc_get_status always returns -1 #10239

Closed
@pezcurrel

Description

@pezcurrel

Description

The following code:

<?php
$p = proc_open('sleep 1', array(), $foo);
do {
    usleep(100000);
    $s = proc_get_status($p);
    echo $s['running'] ? 'Running' : 'Finished', PHP_EOL;
} while ($s['running']);
echo proc_close($p), PHP_EOL;

Resulted in this output:

Running
Running
Running
...
Finished
-1

But I expected this output instead:

Running
Running
Running
...
Finished
0

PHP Version

PHP 8.1.13

Operating System

Arch Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions