Please add capability to allow hook to read from stdin instead of /dev/tty #37

Closed
opened 2025-12-29 00:23:02 +01:00 by adam · 5 comments
Owner

Originally created by @nneul on GitHub (Jan 21, 2016).

Right now, the way it's written, hooks can't do normal IO then get immediate EOF.

While it's straightforward enough to run under expect/whatever, would be nice if a simple read/prompt would work.

Originally created by @nneul on GitHub (Jan 21, 2016). Right now, the way it's written, hooks can't do normal IO then get immediate EOF. While it's straightforward enough to run under expect/whatever, would be nice if a simple read/prompt would work.
adam added the help wanted label 2025-12-29 00:23:02 +01:00
adam closed this issue 2025-12-29 00:23:02 +01:00
Author
Owner

@lukas2511 commented on GitHub (Jan 22, 2016):

I actually have no idea what you are asking for.

Hooks are just called as simple commands in the script with all data passed as arguments, there is no need to read from anywhere.

@lukas2511 commented on GitHub (Jan 22, 2016): I actually have no idea what you are asking for. Hooks are just called as simple commands in the script with all data passed as arguments, there is no need to read from anywhere.
Author
Owner

@nneul commented on GitHub (Jan 22, 2016):

In my case when testing, I was an interactive prompt in the hook (wasn't fully automated). With the way it's currently implemented, you can't read from stdin in the hook - you can only read from /dev/tty.

i.e. if you do "read x" in a hook shell script, it will immediately exit (as opposed to read x < /dev/tty which forces a read from the active terminal)

@nneul commented on GitHub (Jan 22, 2016): In my case when testing, I was an interactive prompt in the hook (wasn't fully automated). With the way it's currently implemented, you can't read from stdin in the hook - you can only read from /dev/tty. i.e. if you do "read x" in a hook shell script, it will immediately exit (as opposed to read x < /dev/tty which forces a read from the active terminal)
Author
Owner

@lukas2511 commented on GitHub (Jan 22, 2016):

I see what you mean, but I'm not entirely sure why this happens...

@lukas2511 commented on GitHub (Jan 22, 2016): I see what you mean, but I'm not entirely sure why this happens...
Author
Owner

@nneul commented on GitHub (Jan 22, 2016):

Found it. It's from this in command_sign_domains:

 <"${DOMAINS_TXT}" _sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' -e 's/[[:space:]]+/ /g' | (grep -vE '^(#|$)' || true) | while read -r line; do

During the entire loop, stdin is captured. Have a pr coming.

@nneul commented on GitHub (Jan 22, 2016): Found it. It's from this in command_sign_domains: ``` <"${DOMAINS_TXT}" _sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' -e 's/[[:space:]]+/ /g' | (grep -vE '^(#|$)' || true) | while read -r line; do ``` During the entire loop, stdin is captured. Have a pr coming.
Author
Owner

@nneul commented on GitHub (Jan 23, 2016):

What about this implementation #110

@nneul commented on GitHub (Jan 23, 2016): What about this implementation #110
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dehydrated#37