Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
01507d9b
Unverified
Commit
01507d9b
authored
Feb 20, 2018
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd, console: support all termination signals
parent
5603715c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
consolecmd.go
cmd/geth/consolecmd.go
+2
-1
cmd.go
cmd/utils/cmd.go
+3
-2
console.go
console/console.go
+2
-1
No files found.
cmd/geth/consolecmd.go
View file @
01507d9b
...
...
@@ -22,6 +22,7 @@ import (
"os/signal"
"path/filepath"
"strings"
"syscall"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/console"
...
...
@@ -207,7 +208,7 @@ func ephemeralConsole(ctx *cli.Context) error {
}
// Wait for pending callbacks, but stop for Ctrl-C.
abort
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
abort
,
os
.
Interrupt
)
signal
.
Notify
(
abort
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
go
func
()
{
<-
abort
...
...
cmd/utils/cmd.go
View file @
01507d9b
...
...
@@ -25,6 +25,7 @@ import (
"os/signal"
"runtime"
"strings"
"syscall"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
...
...
@@ -64,7 +65,7 @@ func StartNode(stack *node.Node) {
}
go
func
()
{
sigc
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
sigc
,
os
.
Interrupt
)
signal
.
Notify
(
sigc
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
defer
signal
.
Stop
(
sigc
)
<-
sigc
log
.
Info
(
"Got interrupt, shutting down..."
)
...
...
@@ -85,7 +86,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
// If a signal is received, the import will stop at the next batch.
interrupt
:=
make
(
chan
os
.
Signal
,
1
)
stop
:=
make
(
chan
struct
{})
signal
.
Notify
(
interrupt
,
os
.
Interrupt
)
signal
.
Notify
(
interrupt
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
defer
signal
.
Stop
(
interrupt
)
defer
close
(
interrupt
)
go
func
()
{
...
...
console/console.go
View file @
01507d9b
...
...
@@ -26,6 +26,7 @@ import (
"regexp"
"sort"
"strings"
"syscall"
"github.com/ethereum/go-ethereum/internal/jsre"
"github.com/ethereum/go-ethereum/internal/web3ext"
...
...
@@ -332,7 +333,7 @@ func (c *Console) Interactive() {
}()
// Monitor Ctrl-C too in case the input is empty and we need to bail
abort
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
abort
,
os
.
Interrupt
)
signal
.
Notify
(
abort
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
// Start sending prompts to the user and reading back inputs
for
{
...
...
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