mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
Merge pull request #427 from zseha/master
^D interrupt does the same as ^C
This commit is contained in:
commit
08a5ebb328
2 changed files with 11 additions and 9 deletions
18
main.go
18
main.go
|
@ -93,14 +93,8 @@ func main() {
|
|||
for sess.Active {
|
||||
line, err := sess.ReadLine()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
continue
|
||||
} else if err.Error() == "Interrupt" {
|
||||
var ans string
|
||||
fmt.Printf("Are you sure you want to quit this session? y/n ")
|
||||
fmt.Scan(&ans)
|
||||
|
||||
if strings.ToLower(ans) == "y" {
|
||||
if err == io.EOF || err.Error() == "Interrupt" {
|
||||
if exitPrompt() {
|
||||
sess.Run("exit")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
@ -117,3 +111,11 @@ func main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func exitPrompt() bool {
|
||||
var ans string
|
||||
fmt.Printf("Are you sure you want to quit this session? y/n ")
|
||||
fmt.Scan(&ans)
|
||||
|
||||
return strings.ToLower(ans) == "y"
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ func (s *Session) setupReadline() (err error) {
|
|||
cfg := readline.Config{
|
||||
HistoryFile: history,
|
||||
InterruptPrompt: "^C",
|
||||
EOFPrompt: "exit",
|
||||
EOFPrompt: "^D",
|
||||
AutoComplete: readline.NewPrefixCompleter(prefixCompleters...),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue