Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix lint commands frozen on empty stdin #33523

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

Merged
merged 1 commit into from
Sep 18, 2019
Merged

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Sep 9, 2019

Q A
Branch? 4.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Running e.g. lint:yaml - with no piped content makes the command hangs currently, this makes it fail instead. Also fixes the command help which we forgot to update

@chalasr chalasr added this to the next milestone Sep 9, 2019
@chalasr chalasr force-pushed the lint-layer branch 2 times, most recently from 8daae93 to 06702ed Compare September 9, 2019 17:13
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Sep 9, 2019

This is wrong, hanging is normal behavior, the command waits for EOF, which is CTRL+D. That's exactly the same with any Unix command that reads from stdin.

The fact it works is relying on a race condition. Don't be fooled.

For 4.4 only, master shouldn't rely on ftell()

@chalasr
Copy link
Member Author

chalasr commented Sep 9, 2019

Sure, but it's a behavior change which might give false positives in a CI. Take e.g:

cat unexisting | bin/console lint:yaml

On 4.3 the output is an error message and exit code is 1. On 4.4-dev it succeeds with code 0.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Oh I thought you submitted that again master. For 4.4 it works for me!

@chalasr chalasr force-pushed the lint-layer branch 4 times, most recently from 5f1ac9d to 6472304 Compare September 10, 2019 04:17
Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

Much better imo, thanks!

@nicolas-grekas
Copy link
Member

Thank you @chalasr.

nicolas-grekas added a commit that referenced this pull request Sep 18, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

Fix lint commands frozen on empty stdin

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Running e.g. `lint:yaml -` with no piped content makes the command hangs currently, this makes it fail instead. Also fixes the command help which we forgot to update

Commits
-------

b60e0c1 Fix lint commands frozen on empty stdin
@nicolas-grekas nicolas-grekas merged commit b60e0c1 into symfony:4.4 Sep 18, 2019
@chalasr chalasr deleted the lint-layer branch September 18, 2019 16:47
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants