git likes to wait on hooks if you keep STD* open

Wed, 03 Apr 2019 03:11:25 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 03 Apr 2019 03:11:25 -0400
changeset 752
bdbfa576e84f
parent 751
96ce87777789
child 753
fadb5356ae65

git likes to wait on hooks if you keep STD* open

bin/git-ctags file | annotate | diff | comparison | revisions
--- a/bin/git-ctags
+++ b/bin/git-ctags
@@ -26,6 +26,7 @@ opts   = File.exists?(conf) ? "--options
 
 if running_hook
   fork and exit
+  [STDIN, STDOUT, STDERR].each(&:close)
   sleep 5
 end
 
@@ -53,7 +54,8 @@ git-ctags - run ctags on git tracked fil
 
  git ctags
 
- echo 'git ctags hook 2>/dev/null' >> .git/hooks/post-checkout
+ echo 'git ctags hook 2>/dev/null' >> .git/hooks/post-checkout &&
+   chmod +x $_
 
  git checkout some/branch
  CTAGS_SKIP=1 git checkout some/branch

mercurial