Skip to content
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

Fix support for piping STDIN #1134

Merged
merged 1 commit into from
Mar 25, 2022
Merged

Conversation

mhssmnn
Copy link
Contributor

@mhssmnn mhssmnn commented Feb 7, 2022

Since the change to Open3 STDIN is not sent to prettier, so formatting produces an empty output.

This sets the :stdin_data option to pass Open3 the STDIN.

The previous use of system seems to have implicitly used the parent STDIN.

Since the change to Open3 `STDIN` is not sent to prettier, so formatting produces an empty output.
@kddnewton
Copy link
Member

Nice fix, thanks!

@kddnewton kddnewton merged commit 9bb3895 into prettier:main Mar 25, 2022
@molawson
Copy link

@kddnewton I seem to be having the opposite problem with this now. I and a coworker noticed separately that calling bundle exec rbprettier --write . (really, any CLI options behaved the same) would seem to hang indefinitely, and we wouldn't see anything until we hit <Enter> a second time.

It looks like with this change, Open3.capture3 is waiting for input from STDIN to close before showing any output. The command appears to be running in the background but no output is shown.

When I run this locally, removing the stdin_data arg makes the command run without extra input, and it prints the lists of files it has processed. Is there something I'm missing here?

mhssmnn added a commit to mhssmnn/plugin-ruby that referenced this pull request Jun 26, 2022
Seems like prettier#1134 caused the process to wait for stdin.

This PR only passes the `:stdin_data` option if `STDIN` is not attached to a terminal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants