Pre-commit: daemon hook

Created on 31 May 2019  路  4Comments  路  Source: pre-commit/pre-commit

Use case:

  • Auto-update my tags with ctags on pre-commit
  • The update takes time and I don't want to wait for it to finish.

Config tried:

---
repos:
  - repo: local
    hooks:
      - id: ctags
        name: Update tags
        entry: git ctags &  # git config --global alias.ctags '!.git/hooks/ctags*'
        language: system

Adding & after git ctags didn't change anything, and pre-commit still waits for ctags to finish before commiting.

What is the proper way to daemon-start a command?

question

All 4 comments

pre-commit doesn't use a shell in any parts by default (to be cross-platform compatible)

You may be able to do something like this?

        entry: bash -c 'nohup git ctags >& /dev/null &'

@asottile thanks for the suggestion. Unfortunately, this doesn't do the trick and pre-commit still waits for ctags to finish.
Note that I replaced your backtick with a single quote, assuming you made a typo there.

ah right, you need to redirect output as well, let me update

Makes sense :) Thanks a bunch @asottile :beer:

Was this page helpful?
0 / 5 - 0 ratings