From 414ade5b3f047aea8f3e49cd64b12848610d5d35 Mon Sep 17 00:00:00 2001 From: Matthieu Rakotojaona Date: Sat, 18 Jul 2015 21:31:34 +0200 Subject: [PATCH] Signal readiness of mount to potential callers --- cmd/restic/cmd_mount.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 6505ce967..28a4dd18d 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -20,13 +20,17 @@ import ( type CmdMount struct { global *GlobalOptions + ready chan struct{} } func init() { _, err := parser.AddCommand("mount", "mount a repository", "The mount command mounts a repository read-only to a given directory", - &CmdMount{global: &globalOpts}) + &CmdMount{ + global: &globalOpts, + ready: make(chan struct{}, 1), + }) if err != nil { panic(err) } @@ -76,6 +80,8 @@ func (cmd CmdMount) Execute(args []string) error { cmd.global.Printf("Now serving %s under %s\n", repo.Backend().Location(), mountpoint) cmd.global.Printf("Don't forget to umount after quitting !\n") + cmd.ready <- struct{}{} + err = fs.Serve(c, &root) if err != nil { return err