Skip to content

Commit 5e80471

Browse files
staabmsebastianbergmann
authored andcommitted
Windows does not support exclusive locks on stdout
1 parent 406a2b4 commit 5e80471

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Logging/EventLogger.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ public function trace(Event $event): void
4040
$indentation = PHP_EOL . str_repeat(' ', strlen($telemetryInfo));
4141
$lines = preg_split('/\r\n|\r|\n/', $event->asString());
4242

43+
$flags = FILE_APPEND;
44+
45+
if (PHP_OS_FAMILY !== 'Windows' || $this->path !== 'php://stdout') {
46+
$flags |= LOCK_EX;
47+
}
48+
4349
file_put_contents(
4450
$this->path,
4551
$telemetryInfo . implode($indentation, $lines) . PHP_EOL,
46-
FILE_APPEND | LOCK_EX,
52+
$flags,
4753
);
4854
}
4955

0 commit comments

Comments
 (0)