Skip to content

Commit 013126d

Browse files
christianseelnicolas-grekas
authored andcommitted
[Process] Enhance hasSystemCallBeenInterrupted function for non-english locale
1 parent e5772a9 commit 013126d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Symfony/Component/Process/Pipes/AbstractPipes.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,26 @@ public function close(): void
5252

5353
/**
5454
* Returns true if a system call has been interrupted.
55+
*
56+
* stream_select() returns false when the `select` system call is interrupted by an incoming signal.
5557
*/
5658
protected function hasSystemCallBeenInterrupted(): bool
5759
{
5860
$lastError = $this->lastError;
5961
$this->lastError = null;
6062

61-
// stream_select returns false when the `select` system call is interrupted by an incoming signal
62-
return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
63+
if (null === $lastError) {
64+
return false;
65+
}
66+
67+
if (false !== stripos($lastError, 'interrupted system call')) {
68+
return true;
69+
}
70+
71+
// on applications with a different locale than english, the message above is not found because
72+
// it's translated. So we also check for the SOCKET_EINTR constant which is defined under
73+
// Windows and UNIX-like platforms (if available on the platform).
74+
return \defined('SOCKET_EINTR') && str_starts_with($lastError, 'stream_select(): Unable to select ['.\SOCKET_EINTR.']');
6375
}
6476

6577
/**

0 commit comments

Comments
 (0)