Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] Detect if interactive mode is possible at all#1699

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 2 commits intosymfony:masterfromlenar:input-isatty
Sep 29, 2011
Merged

[Console] Detect if interactive mode is possible at all#1699

fabpot merged 2 commits intosymfony:masterfromlenar:input-isatty
Sep 29, 2011

Conversation

@lenar
Copy link
Contributor

No description provided.

@fabpot
Copy link
Member

You can use the dialog helper without a tty (think unit tests). seehttps://github.com/sensio/SensioGeneratorBundle/blob/master/Tests/Command/GenerateDoctrineCrudCommandTest.php#L24

@fabpotfabpot closed thisJul 20, 2011
@lenar
Copy link
ContributorAuthor

@fabpot: this change doesn't prevent those tests from running (and successfully so). Please reconsider including.

@fabpotfabpot reopened thisJul 25, 2011
@lenar
Copy link
ContributorAuthor

Rebased.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The dialog helper is not always available, so this need to be checked.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ok.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Added check.

fabpot added a commit that referenced this pull requestSep 29, 2011
Commits-------fd00ed0 [Console] Check if dialog helper actually exists0f7bf41 [Console] Detect if interactive mode is possible at allDiscussion----------[Console] Detect if interactive mode is possible at all---------------------------------------------------------------------------by fabpot at 2011/07/19 22:52:14 -0700You can use the dialog helper without a tty (think unit tests). seehttps://github.com/sensio/SensioGeneratorBundle/blob/master/Tests/Command/GenerateDoctrineCrudCommandTest.php#L24---------------------------------------------------------------------------by lenar at 2011/07/25 06:18:48 -0700@fabpot: this change doesn't prevent those tests from running (and successfully so). Please reconsider including.---------------------------------------------------------------------------by lenar at 2011/07/27 01:30:20 -0700Rebased.
@fabpotfabpot merged commitfd00ed0 intosymfony:masterSep 29, 2011
nicolas-grekas added a commit that referenced this pull requestFeb 7, 2020
This PR was submitted for the master branch but it was merged into the 4.4 branch instead.Discussion----------[Console] Consider STDIN interactive| Q             | A| ------------- | ---| Branch?       |4.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       |Fix#30726, supersedes#30796| License       | MIT| Doc PR        | -As demonstrated with `yes | bin/console foo` in#30726, original assumption made in#1699 was wrong. Then,#8452 was merged which solved bug#8079 -> this was a use case when application hangs with `--no-interaction` flag - nobody probably realized that application can be in "non-interactive" mode, without using this flag and not hang. Then, there was#14102 which was poor man's fix for problem caused by this. So already plenty issues this behaviour causes. Looks like a mess to me. Application should be considered non-interactive only when explicitly specified so (--no-interactive flag), otherwise it doesn't hang.### What this change means?It only changes one case: When doing `echo foo | bin/console bar`, `yes | bin/console bar`, `bin/console bar < foo`, etc. Redirecting stdout is not affected, as application in that case was considered interactive before too. With stdin, this opens possibility to control symfony/console based application by default via stdin, including via `proc_open`.Additionally, not only it allows to control the input for questions, it also makes the question and answers to display on screen. So before, user had no idea what questions are happening and what answers (defaults) are being used.### About a BC breakI'm not really aware of a valid use case this can break. Can you help find any?1. Since symfony/console components were NOT interactive with stdin before, stdin couldn't be used to control them - so there this change breaks nothing, because it didn't make sense to pass stdin there instead of specifying -n flag.1. If application uses internal logic where it relies on STDIN disregarding `Output::isInteractive` flag, this doesn't change anything for these either - they will keep using STDIN disregarding result of this flag.1. What if application uses internal logic for stdin AND console components like QuestionHelper? To me, that doesn't make much sense, because with previous behaviour, such questions would result always into defaults. It might make sense in case application supports both modes - either stdin, or user supplied input and just use default answers with stdin. But I cannot figure out example of such use - what would be the case where application allows user to control something via stdin, but at the same time forbids them to set certain aspects (answers to questions given)?1. What about `SHELL_INTERACTIVE` env variable? Only way to utilize it was to force enable interactive mode, but since it will be interactive now by default, it will do nothing and no behaviour changes.1. Preventing stdin control was much bigger potential BC break. Despite that, it was disallowed in minor Symfony version. And as far as I can see, I saw no backlash.Finally, this targets Symfony 5.0 to be extra sure anyways, so I think it's ok, but feel free to suggest documenting this in upgrade guide or changelog. I would even target 4.4, but chose 5.0 as it's easier to push through there.Commits-------ef157d5 [Console] Consider STDIN interactive
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

2.1

Development

Successfully merging this pull request may close these issues.

2 participants

@lenar@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp