From 4ac6db9a2486fa9e8f66983de19edf4dcdc1d92a Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Sun, 16 Nov 2014 02:35:13 -0800 Subject: [PATCH] ipfs1/mount: text + unmounting --- cmd/ipfs/mount_unix.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmd/ipfs/mount_unix.go b/cmd/ipfs/mount_unix.go index c98a02273..15f422578 100644 --- a/cmd/ipfs/mount_unix.go +++ b/cmd/ipfs/mount_unix.go @@ -3,6 +3,11 @@ package main import ( + "fmt" + "os" + "os/signal" + "syscall" + "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag" "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander" @@ -90,9 +95,21 @@ func doMount(node *core.IpfsNode, fsdir, nsdir string) error { } } + fmt.Printf("mounted ipfs at %s\n", fsdir) + fmt.Printf("mounted ipns at %s\n", nsdir) + // setup node state, so that it can be cancelled node.Mounts.Ipfs = fsmount node.Mounts.Ipns = nsmount + + // wait until we kill + sigc := make(chan os.Signal, 1) + signal.Notify(sigc, syscall.SIGHUP, syscall.SIGINT, + syscall.SIGTERM, syscall.SIGQUIT) + <-sigc + + fmt.Println("unmounting...") + node.Close() return nil }