Respect TTY availability when running the dev server - #144
Open
Ikromjon1998 wants to merge 1 commit into
Open
Conversation
executeCommand() enables TTY mode whenever the caller has not asked for
non-interactive mode, without checking whether a TTY is actually
available. In any environment without one — CI, a scripted deploy, an
editor task runner, a background shell — Symfony throws before the
process starts:
TTY mode requires /dev/tty to be read/writable.
at vendor/symfony/process/Process.php:1087
This makes `native:run` and `native:serve` unusable outside an
interactive terminal. `--no-interaction` does not help, because it is
only threaded through to the dependency install; the dev server call
still requests a TTY.
BuildCommand already guards this with Process::isTtySupported(), so this
applies the same check here and keeps the two paths consistent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
php artisan native:run(ornative:serve) outside an interactive terminal fails before the process starts:ExecuteCommand::executeCommand()enables TTY mode whenever the caller has not explicitly asked for non-interactive mode, without checking whether a TTY is actually available:So the dev server cannot be started from CI, a scripted deploy, an editor task runner, or any background shell.
--no-interactiondoes not help: it is threaded through to the dependency install, but thedevinvocation still requests a TTY.BuildCommandalready guards against this (BuildCommand.php:183):This applies the same
isTtySupported()check inexecuteCommand(), so both paths behave consistently. Where a TTY exists the behaviour is unchanged; where none exists the process now runs with piped output instead of throwing.Verifying
With this change,
php artisan native:runstarts normally in a non-interactive shell where it previously aborted at the TTY check. Without it, the same invocation needs a pseudo-terminal wrapper (script -q /dev/null php artisan native:run) as a workaround.Pint and PHPStan pass on the changed file.