From 25068c2ccd3790b9dda55c8141ad49c628727f2b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 17 Nov 2020 15:49:08 +0200 Subject: [PATCH] hooks: allow input from stdin Let hooks receive user input if applicable. Closing stdin originates in f5bbc3225 (Port git commit to C, 2007). Looks like the original shell implementation did have stdin open. Not clear why the author chose to close it on the C port (maybe copy&paste). Some references of users requesting this feature. Some of them use acrobatics to gain access to stdin: [1] https://stackoverflow.com/q/1067874/764870 [2] https://stackoverflow.com/q/47477766/764870 [3] https://stackoverflow.com/q/3417896/764870 [4] https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3165 [5] https://github.com/typicode/husky/issues/442 --- run-command.c | 1 - 1 file changed, 1 deletion(-) diff --git a/run-command.c b/run-command.c index 2ee59acdc8c828..a17b613216aa2b 100644 --- a/run-command.c +++ b/run-command.c @@ -1356,7 +1356,6 @@ int run_hook_ve(const char *const *env, const char *name, va_list args) while ((p = va_arg(args, const char *))) strvec_push(&hook.args, p); hook.env = env; - hook.no_stdin = 1; hook.stdout_to_stderr = 1; hook.trace2_hook_name = name;