@cryptotaxi247 / kubo / commits / 9b0c578fc

better cleanup of ipfs on program exit

Jeromy committed Sep 27, 2014 at 13:10 UTC 9b0c578fc0a60b014981cd8e723a5ff3bcee0f58
2 files changed +9 -2
cmd/ipfs/mount_unix.go
+8 -1
@@ -72,15 +72,22 @@ func mountCmd(c *commander.Command, inp []string) error {
72 mp := inp[0]
73 fmt.Printf("Mounting at %s\n", mp)
74
75 + var ipnsDone chan struct{}
76 ns, ok := c.Flag.Lookup("n").Value.Get().(string)
77 if ok {
78 + ipnsDone = make(chan struct{})
79 go func() {
80 err = ipns.Mount(n, ns, mp)
81 if err != nil {
82 fmt.Printf("Error mounting ipns: %s\n", err)
83 }
84 + ipnsDone <- struct{}{}
85 }()
86 }
87
85 - return rofs.Mount(n, mp)
88 + err = rofs.Mount(n, mp)
89 + if ipnsDone != nil {
90 + <-ipnsDone
91 + }
92 + return err
93 }
daemon/daemon_client.go
+1 -1
@@ -60,7 +60,7 @@ func SendCommand(command *Command, confdir string) error {
60 return ErrDaemonNotRunning
61 }
62
63 - log.Info("Daemon is running! %s", err)
63 + log.Info("Daemon is running! [reason = %s]", err)
64
65 server, err := getDaemonAddr(confdir)
66 if err != nil {