Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/geth, console: support interrupting the js console #23387

Merged
merged 17 commits into from
Dec 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cmd/geth: explain shutdown tracking better
  • Loading branch information
fjl committed Dec 6, 2021
commit 7a70321f6b0560e819c2e8b2aeae637c05f8f7d1
7 changes: 4 additions & 3 deletions cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ func localConsole(ctx *cli.Context) error {
if err != nil {
utils.Fatalf("Failed to start the JavaScript console: %v", err)
}
defer console.Stop(false)

// Track node shutdown and stop the console when it goes down.
// This happens when SIGTERM is sent to the process.
exitCh := make(chan struct{})
go func() {
// In case the blockchain is stopped, e.g. via ctrl-c, we should
// also close down the console.
stack.Wait()
close(exitCh)
}()
defer console.Stop(false)

// If only a short execution was requested, evaluate and return
if script := ctx.GlobalString(utils.ExecFlag.Name); script != "" {
Expand Down