diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 591675de1fc..fb2077cdf13 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -288,9 +288,6 @@ func daemonFunc(req cmds.Request, res cmds.Response) { corehttp.VersionOption(), } - // our global interrupt handler can now try to stop the daemon - close(req.Context().InitDone) - if rootRedirect != nil { opts = append(opts, rootRedirect) } diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 0ad4564cbbe..a4df91d444d 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -133,14 +133,6 @@ func main() { os.Exit(1) } - // our global interrupt handler may try to stop the daemon - // before the daemon is ready to be stopped; this dirty - // workaround is for the daemon only; other commands are always - // ready to be stopped - if invoc.cmd != daemonCmd { - close(invoc.req.Context().InitDone) - } - // ok, finally, run the command invocation. intrh, ctx := invoc.SetupInterruptHandler(ctx) defer intrh.Close() @@ -518,15 +510,6 @@ func (i *cmdInvocation) SetupInterruptHandler(ctx context.Context) (io.Closer, c case 1: fmt.Println() // Prevent un-terminated ^C character in terminal - ctx := i.req.Context() - - // if we're still initializing, cannot use `ctx.GetNode()` - select { - default: // initialization not done - os.Exit(-1) - case <-ctx.InitDone: - } - ih.wg.Add(1) go func() { defer ih.wg.Done() diff --git a/commands/request.go b/commands/request.go index 17b9dfa7e7d..8938900e16a 100644 --- a/commands/request.go +++ b/commands/request.go @@ -30,7 +30,6 @@ type Context struct { node *core.IpfsNode ConstructNode func() (*core.IpfsNode, error) - InitDone chan bool } // GetConfig returns the config of the current Command exection @@ -288,7 +287,7 @@ func NewRequest(path []string, opts OptMap, args []string, file files.File, cmd optDefs = make(map[string]Option) } - ctx := Context{Context: context.TODO(), InitDone: make(chan bool)} + ctx := Context{Context: context.TODO()} values := make(map[string]interface{}) req := &request{path, opts, args, file, cmd, ctx, optDefs, values, os.Stdin} err := req.ConvertOptions()