Commit 9b0c578f authored by Jeromy's avatar Jeromy Committed by Juan Batiz-Benet

better cleanup of ipfs on program exit

parent ed2fbd05
......@@ -72,15 +72,22 @@ func mountCmd(c *commander.Command, inp []string) error {
mp := inp[0]
fmt.Printf("Mounting at %s\n", mp)
var ipnsDone chan struct{}
ns, ok := c.Flag.Lookup("n").Value.Get().(string)
if ok {
ipnsDone = make(chan struct{})
go func() {
err = ipns.Mount(n, ns, mp)
if err != nil {
fmt.Printf("Error mounting ipns: %s\n", err)
}
ipnsDone <- struct{}{}
}()
}
return rofs.Mount(n, mp)
err = rofs.Mount(n, mp)
if ipnsDone != nil {
<-ipnsDone
}
return err
}
......@@ -60,7 +60,7 @@ func SendCommand(command *Command, confdir string) error {
return ErrDaemonNotRunning
}
log.Info("Daemon is running! %s", err)
log.Info("Daemon is running! [reason = %s]", err)
server, err := getDaemonAddr(confdir)
if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment