It would be useful to have a command to be able to halt the daemon programmatically, either ipfs daemon stop or ipfs daemon shutdown.
Related Issues:
we have this now. ipfs shutdown
This is not an issue, but more of a query. I am sorry if this is not the right forum for it but as its specific to this command I was hoping to get some help here.
I am working on something where I programatically start the ipfs node. I was trying to understand the shutdown code.
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
nd, err := cmdenv.GetNode(env)
if err != nil {
return err
}
if !nd.IsDaemon {
return cmds.Errorf(cmds.ErrClient, "daemon not running")
}
if err := nd.Close(); err != nil {
log.Error("error while shutting down ipfs daemon:", err)
}
return nil
},
The ipfs daemon is running in a separate process. How is this able to stop the same running node? Is there some way this cmdenv is able to share memory between processes?
I might have to go much deeper in code to understand this, so if anyone knows it on the top of their head I would really appreciate it!
I'd be happy to answer this question on https://discuss.ipfs.io.
I'd be happy to answer this question on https://discuss.ipfs.io.
Created a topic here:
https://discuss.ipfs.io/t/sharing-memory-in-ipfs-commands/6745?u=aloknerurkar
Most helpful comment
we have this now.
ipfs shutdown