Skip to content

Commit cef3e2d

Browse files
authored
console: don't exit on ctrl-c, only on ctrl-d (#21660)
* add interrupt counter * remove interrupt counter, allow ctrl-C to clear ONLY, ctrl-D will terminate console, stop node * format * add instructions to exit * fix tests
1 parent b305591 commit cef3e2d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎cmd/geth/consolecmd_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ at block: 0 ({{niltime}})
6666
datadir: {{.Datadir}}
6767
modules: {{apis}}
6868
69+
To exit, press ctrl-d
6970
> {{.InputLine "exit"}}
7071
`)
7172
geth.ExpectExit()
@@ -159,6 +160,7 @@ at block: 0 ({{niltime}}){{if ipc}}
159160
datadir: {{datadir}}{{end}}
160161
modules: {{apis}}
161162
163+
To exit, press ctrl-d
162164
> {{.InputLine "exit" }}
163165
`)
164166
attach.ExpectExit()

‎console/console.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ func (c *Console) Welcome() {
324324
sort.Strings(modules)
325325
message += " modules: " + strings.Join(modules, " ") + "\n"
326326
}
327+
message += "\nTo exit, press ctrl-d"
327328
fmt.Fprintln(c.printer, message)
328329
}
329330

@@ -372,7 +373,7 @@ func (c *Console) Interactive() {
372373
return
373374

374375
case err := <-inputErr:
375-
if err == liner.ErrPromptAborted && indents > 0 {
376+
if err == liner.ErrPromptAborted {
376377
// When prompting for multi-line input, the first Ctrl-C resets
377378
// the multi-line state.
378379
prompt, indents, input = c.prompt, 0, ""

0 commit comments

Comments
 (0)