Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
8bcf6f48
Commit
8bcf6f48
authored
Jul 31, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upgrade shutdown command to the new commands lib
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
4bca53e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
core/commands/root.go
core/commands/root.go
+1
-1
core/commands/shutdown.go
core/commands/shutdown.go
+5
-8
No files found.
core/commands/root.go
View file @
8bcf6f48
...
...
@@ -138,7 +138,7 @@ var rootSubcommands = map[string]*cmds.Command{
"update"
:
lgc
.
NewCommand
(
ExternalBinary
()),
"urlstore"
:
urlStoreCmd
,
"version"
:
lgc
.
NewCommand
(
VersionCmd
),
"shutdown"
:
lgc
.
NewCommand
(
daemonShutdownCmd
)
,
"shutdown"
:
daemonShutdownCmd
,
}
// RootRO is the readonly version of Root
...
...
core/commands/shutdown.go
View file @
8bcf6f48
...
...
@@ -3,31 +3,28 @@ package commands
import
(
"fmt"
cmds
"gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
cmds
"github.com/ipfs/go-ipfs/commands"
)
var
daemonShutdownCmd
=
&
cmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Shut down the ipfs daemon"
,
},
Run
:
func
(
req
cmds
.
Request
,
re
s
cmds
.
Response
)
{
nd
,
err
:=
req
.
InvocContext
()
.
GetNode
()
Run
:
func
(
req
*
cmds
.
Request
,
re
cmds
.
Response
Emitter
,
env
cmds
.
Environment
)
{
nd
,
err
:=
GetNode
(
env
)
if
err
!=
nil
{
re
s
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
re
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
if
nd
.
LocalMode
()
{
re
s
.
SetError
(
fmt
.
Errorf
(
"daemon not running"
),
cmdkit
.
ErrClient
)
re
.
SetError
(
fmt
.
Errorf
(
"daemon not running"
),
cmdkit
.
ErrClient
)
return
}
if
err
:=
nd
.
Process
()
.
Close
();
err
!=
nil
{
log
.
Error
(
"error while shutting down ipfs daemon:"
,
err
)
}
res
.
SetOutput
(
nil
)
},
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment