Skip to content

Commit 67679e3

Browse files
nielsdospezcurrel
andcommitted
Add regression tests for GH-10239
Co-authored-by: pezcurrel <33592962+pezcurrel@users.noreply.github.com>
1 parent 6ae73d8 commit 67679e3

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-10239 (proc_close after proc_get_status always returns -1)
3+
--SKIPIF--
4+
<?php
5+
if (PHP_OS != "Linux") die("skip, only for linux");
6+
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
7+
?>
8+
--FILE--
9+
<?php
10+
$p = proc_open('sleep 1', array(), $foo);
11+
do {
12+
usleep(100000);
13+
$s = proc_get_status($p);
14+
} while ($s['running']);
15+
echo proc_close($p), PHP_EOL;
16+
?>
17+
--EXPECT--
18+
0
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--TEST--
2+
GH-10239 (proc_close after proc_get_status always returns -1)
3+
--SKIPIF--
4+
<?php
5+
if (PHP_OS != "Linux") die("skip, only for linux");
6+
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
7+
?>
8+
--FILE--
9+
<?php
10+
$p = proc_open('false', array(), $foo);
11+
usleep(2 * 1000 * 1000);
12+
var_dump(proc_get_status($p));
13+
var_dump(proc_get_status($p));
14+
?>
15+
--EXPECTF--
16+
array(8) {
17+
["command"]=>
18+
string(5) "false"
19+
["pid"]=>
20+
int(%d)
21+
["running"]=>
22+
bool(false)
23+
["signaled"]=>
24+
bool(false)
25+
["stopped"]=>
26+
bool(false)
27+
["exitcode"]=>
28+
int(1)
29+
["termsig"]=>
30+
int(0)
31+
["stopsig"]=>
32+
int(0)
33+
}
34+
array(8) {
35+
["command"]=>
36+
string(5) "false"
37+
["pid"]=>
38+
int(%d)
39+
["running"]=>
40+
bool(false)
41+
["signaled"]=>
42+
bool(false)
43+
["stopped"]=>
44+
bool(false)
45+
["exitcode"]=>
46+
int(1)
47+
["termsig"]=>
48+
int(0)
49+
["stopsig"]=>
50+
int(0)
51+
}

0 commit comments

Comments
 (0)