Skip to content

Commit 2acafcf

Browse files
mattsebastianbergmann
authored andcommitted
ShutdownHandler does not output in child processes
1 parent 8a84b2a commit 2acafcf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Runner/ShutdownHandler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PHPUnit\Runner;
1111

1212
use const PHP_EOL;
13+
use function getmypid;
1314
use function register_shutdown_function;
1415
use function rtrim;
1516

@@ -42,13 +43,14 @@ private static function register(): void
4243
}
4344

4445
self::$registered = true;
46+
$pid = getmypid();
4547

4648
register_shutdown_function(
47-
static function (): void
49+
static function () use ($pid): void
4850
{
4951
$message = rtrim(self::$message);
5052

51-
if ($message === '') {
53+
if ($message === '' || $pid !== getmypid()) {
5254
return;
5355
}
5456

0 commit comments

Comments
 (0)