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

Input is not to a terminal (fd=0) error (within git hook) #1030

Closed
menaveenshankar opened this issue Dec 14, 2019 · 4 comments
Closed

Input is not to a terminal (fd=0) error (within git hook) #1030

menaveenshankar opened this issue Dec 14, 2019 · 4 comments

Comments

@menaveenshankar
Copy link

menaveenshankar commented Dec 14, 2019

Hello,
I am trying to use prompt_toolkit within a git hook (prepare-commit-msg). I get this warning - Input is not to a terminal (fd=0) I would appreciate any pointers on how to solve this.

I am using python 3.7.5. prompt_toolkit.__version__ = '2.0.10'

screenshot of the errors that follow -
prompt_toolkit_fail_githook

@menaveenshankar menaveenshankar changed the title Input is not to a terminal (fd=0) within git hook Input is not to a terminal (fd=0) error (within git hook) Dec 15, 2019
@halloleo
Copy link

Not an expert on prompt-toolkit, but I would guess the problem is that prompt-toolkit
expects to be connected to a tty and in your hook you might not have a tty. I assume prompt-toolkit is called by a parent app. Why is that app calling into prompt-toolkit?

@menaveenshankar
Copy link
Author

Hi halloleo, I have a tty connected, i.e. sys.stdin = open('/dev/tty', 'r') before I call the prompt() function. I am implementing autocomplete feature in the hook (the hook itself is in python). If I call the same functionality as a normal python script it works fine, but not within the hook environment even though I have a tty.

@halloleo
Copy link

prompt-toolkit needs unfortunately more than just a minimal tty. (see #1032).

@menaveenshankar
Copy link
Author

prompt-toolkit needs unfortunately more than just a minimal tty. (see #1032).

ah i see, thanks for the info. On a related note, I tried a simpler version of autocomplete with the readline package, still doesn't work (posted it in sof too - link ). seems like there is some other issue within the git hook environment.

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

No branches or pull requests

2 participants