diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-21 18:46:53 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-21 19:13:08 +0200 |
commit | 6d7dc465d881d0d04b01dfb6e09870346216d2d0 (patch) | |
tree | fbbce01c6b7634556303a3d917d1036767280d17 /commands/root.go | |
parent | 942178288d657202b3f7afd386b319a245afbb7e (diff) | |
download | git-bug-6d7dc465d881d0d04b01dfb6e09870346216d2d0.tar.gz |
cache: lock the repo with a pid file; automatic cleaning
Diffstat (limited to 'commands/root.go')
-rw-r--r-- | commands/root.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/commands/root.go b/commands/root.go index bbf7d6de..9435ce64 100644 --- a/commands/root.go +++ b/commands/root.go @@ -5,6 +5,7 @@ import ( "os" "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/repository" "github.com/spf13/cobra" ) @@ -68,5 +69,13 @@ func loadRepo(cmd *cobra.Command, args []string) error { return err } + // Prevent the command from running when the cache has locked the repo + // Todo: make it more fine-grained at first + // Todo: make the running cache available for other processes + err = cache.RepoIsAvailable(repo) + if err != nil { + return err + } + return nil } |