forked from TrueCloudLab/restic
Signal readiness of mount to potential callers
This commit is contained in:
parent
a6ce7d9845
commit
414ade5b3f
1 changed files with 7 additions and 1 deletions
|
@ -20,13 +20,17 @@ import (
|
||||||
|
|
||||||
type CmdMount struct {
|
type CmdMount struct {
|
||||||
global *GlobalOptions
|
global *GlobalOptions
|
||||||
|
ready chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
_, err := parser.AddCommand("mount",
|
_, err := parser.AddCommand("mount",
|
||||||
"mount a repository",
|
"mount a repository",
|
||||||
"The mount command mounts a repository read-only to a given directory",
|
"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 {
|
if err != nil {
|
||||||
panic(err)
|
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("Now serving %s under %s\n", repo.Backend().Location(), mountpoint)
|
||||||
cmd.global.Printf("Don't forget to umount after quitting !\n")
|
cmd.global.Printf("Don't forget to umount after quitting !\n")
|
||||||
|
|
||||||
|
cmd.ready <- struct{}{}
|
||||||
|
|
||||||
err = fs.Serve(c, &root)
|
err = fs.Serve(c, &root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue