Skip to content

Commit

Permalink
fixed --force flag for shutdown after update
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptix committed Oct 22, 2014
1 parent d9552fe commit 4f42a26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cmd/ipfs/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (
"github.com/jbenet/go-ipfs/core/commands"
)

func init() {
cmdIpfsUpdate.Flag.Bool("force", false, "force shutdown of daemon when updating")
}

var cmdIpfsUpdate = &commander.Command{
UsageLine: "update",
Short: "check for updates and apply them",
Expand All @@ -20,7 +24,7 @@ I wont even try, @jbenet. You do this much better :)`,
Run: makeCommand(command{
name: "updateApply",
args: 0,
flags: nil,
flags: []string{"force"},
online: true,
cmdFn: commands.UpdateApply,
}),
Expand Down
4 changes: 2 additions & 2 deletions core/commands/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func UpdateApply(n *core.IpfsNode, args []string, opts map[string]interface{}, o
fmt.Fprintln(out, "New Version:", u.Version)

_, onDaemon := opts["onDaemon"]
_, force := opts["force"]
force := opts["force"].(bool)
if onDaemon && !force {
return fmt.Errorf(`Error: update must stop running ipfs service.
You may want to abort the update, or shut the service down manually.
To shut it down automatically, run:
ipfs update apply -f
ipfs update --force
`)
}

Expand Down

0 comments on commit 4f42a26

Please sign in to comment.