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 lefthook capturing stdin from terminal even if when non-interactive and not using stdin #638

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

technicalpickles
Copy link
Contributor

Closes #588

⚡ Summary

If I'm reading the code, this args.in should be a nullReader when non-interactive and not using stdin. For some reason though, it ends up capturing stdin. That is, any typing you do while lefthook is running goes to lefthook, instead of the shell invoking it.

☑️ Checklist

  • Check locally
  • Add tests
  • Add documentation

…ve and not using stdin

If I'm reading the code, this `args.in` should be a nullReader when
non-interactive and not using stdin. For some reason though, it ends up
capturing stdin. That is, any typing you do while lefthook is running
goes to lefthook, instead of the shell invoking it.

Fixes evilmartians#588
@technicalpickles
Copy link
Contributor Author

Add tests

Would love to have tests for this, but I honestly have no idea about how to do it 😬 specifically because I have yet to reproduce #588 in an automated way

@technicalpickles
Copy link
Contributor Author

I'm not sure why coveralls would fail 🤔 if anything, there's one less line to cover right?

CleanShot 2024-02-23 at 12 13 27

@mrexox
Copy link
Member

mrexox commented Feb 26, 2024

That's OK. I think there are no tests that can cover this. Actually this part is legacy since it was here before the use_stdin and interactive options. So, it probably doesn't make sense.

I will have this PR tested locally and then will come back with the resolution.

Thank you for this finding!

@mrexox mrexox merged commit 60df434 into evilmartians:master Feb 26, 2024
14 of 17 checks passed
@technicalpickles technicalpickles deleted the avoid-capturing-stdin branch February 26, 2024 14:28
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.

lefthook can swallow stdin from user typing at the terminal unexpectedly
2 participants