mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 18:57:17 -07:00
fix: clear handler caused issues on some terminals, fixed by using os specific clear command
This commit is contained in:
parent
9f24800e6d
commit
c7f28855ca
1 changed files with 9 additions and 6 deletions
|
@ -4,7 +4,9 @@ import (
|
|||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -249,13 +251,14 @@ func (s *Session) readHandler(args []string, sess *Session) error {
|
|||
}
|
||||
|
||||
func (s *Session) clsHandler(args []string, sess *Session) error {
|
||||
// fixes a weird bug which causes the screen not to be fully
|
||||
// cleared if a "clear; net.show" commands chain is executed
|
||||
// in the interactive session.
|
||||
for i := 0; i < 180; i++ {
|
||||
fmt.Println()
|
||||
cmd := "clear"
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd = "cls"
|
||||
}
|
||||
readline.ClearScreen(s.Input.Stdout())
|
||||
|
||||
c := exec.Command(cmd)
|
||||
c.Stdout = os.Stdout
|
||||
c.Run()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue