-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override Symfony Process. #175
Conversation
Symfony looks like it already does this? symfony/symfony@a1398f6 |
This code: public function setTty(bool $tty): static
{
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
}
if ($tty && !self::isTtySupported()) {
throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
}
$this->tty = $tty;
return $this;
} Is not the same at all, if you look carefully. |
@mjauvin what's the difference? It looks like isTtySupported() also checks the readable / writable status of |
It does, but it looks like PHP's open_basedire restrictions don't apply for this check, but they do for |
Interesting. Can we override isTtySupported() instead and also submit an issue to Symfony to report the problem? |
I tried with this overriden method but it doesn't get called somehow: public static function isTtySupported(): bool
{
static $isTtySupported;
if ('/' === \DIRECTORY_SEPARATOR) {
try {
$readable = is_readable('/dev/tty');
} catch (\Exception $e) {
throw new RuntimeException($e->getMessage());
}
}
return $isTtySupported ??= ('/' === \DIRECTORY_SEPARATOR && stream_isatty(\STDOUT));
} |
Only if I replicate Symfony's Maybe because this is a static method ? |
@LukeTowers The problem is Symfony's setTty() method uses "self::isTtySupported() |
Co-authored-by: Ben Thomson <[email protected]>
Symfony merged the PR, so we won't be needing this. |
This is required in order to handle an exception when open_basedir restrictions are in effect, preventing a process to be created with TTY mode enabled.