Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
7d578246
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
7d578246
编写于
2月 21, 2018
作者:
P
Péter Szilágyi
提交者:
GitHub
2月 21, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16142 from karalabe/graceful-sigterm
cmd, console: support all termination signals
上级
5603715c
01507d9b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
4 deletion
+7
-4
cmd/geth/consolecmd.go
cmd/geth/consolecmd.go
+2
-1
cmd/utils/cmd.go
cmd/utils/cmd.go
+3
-2
console/console.go
console/console.go
+2
-1
未找到文件。
cmd/geth/consolecmd.go
浏览文件 @
7d578246
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"os/signal"
"os/signal"
"path/filepath"
"path/filepath"
"strings"
"strings"
"syscall"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/console"
...
@@ -207,7 +208,7 @@ func ephemeralConsole(ctx *cli.Context) error {
...
@@ -207,7 +208,7 @@ func ephemeralConsole(ctx *cli.Context) error {
}
}
// Wait for pending callbacks, but stop for Ctrl-C.
// Wait for pending callbacks, but stop for Ctrl-C.
abort
:=
make
(
chan
os
.
Signal
,
1
)
abort
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
abort
,
os
.
Interrupt
)
signal
.
Notify
(
abort
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
go
func
()
{
go
func
()
{
<-
abort
<-
abort
...
...
cmd/utils/cmd.go
浏览文件 @
7d578246
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"os/signal"
"os/signal"
"runtime"
"runtime"
"strings"
"strings"
"syscall"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
...
@@ -64,7 +65,7 @@ func StartNode(stack *node.Node) {
...
@@ -64,7 +65,7 @@ func StartNode(stack *node.Node) {
}
}
go
func
()
{
go
func
()
{
sigc
:=
make
(
chan
os
.
Signal
,
1
)
sigc
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
sigc
,
os
.
Interrupt
)
signal
.
Notify
(
sigc
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
defer
signal
.
Stop
(
sigc
)
defer
signal
.
Stop
(
sigc
)
<-
sigc
<-
sigc
log
.
Info
(
"Got interrupt, shutting down..."
)
log
.
Info
(
"Got interrupt, shutting down..."
)
...
@@ -85,7 +86,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
...
@@ -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.
// If a signal is received, the import will stop at the next batch.
interrupt
:=
make
(
chan
os
.
Signal
,
1
)
interrupt
:=
make
(
chan
os
.
Signal
,
1
)
stop
:=
make
(
chan
struct
{})
stop
:=
make
(
chan
struct
{})
signal
.
Notify
(
interrupt
,
os
.
Interrupt
)
signal
.
Notify
(
interrupt
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
defer
signal
.
Stop
(
interrupt
)
defer
signal
.
Stop
(
interrupt
)
defer
close
(
interrupt
)
defer
close
(
interrupt
)
go
func
()
{
go
func
()
{
...
...
console/console.go
浏览文件 @
7d578246
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"regexp"
"regexp"
"sort"
"sort"
"strings"
"strings"
"syscall"
"github.com/ethereum/go-ethereum/internal/jsre"
"github.com/ethereum/go-ethereum/internal/jsre"
"github.com/ethereum/go-ethereum/internal/web3ext"
"github.com/ethereum/go-ethereum/internal/web3ext"
...
@@ -332,7 +333,7 @@ func (c *Console) Interactive() {
...
@@ -332,7 +333,7 @@ func (c *Console) Interactive() {
}()
}()
// Monitor Ctrl-C too in case the input is empty and we need to bail
// Monitor Ctrl-C too in case the input is empty and we need to bail
abort
:=
make
(
chan
os
.
Signal
,
1
)
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
// Start sending prompts to the user and reading back inputs
for
{
for
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录