fix: clear handler caused issues on some terminals, fixed by using os specific clear command

This commit is contained in:
evilsocket 2019-03-22 21:28:57 +01:00
commit c7f28855ca
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -4,7 +4,9 @@ import (
"bufio" "bufio"
"fmt" "fmt"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"runtime"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -249,13 +251,14 @@ func (s *Session) readHandler(args []string, sess *Session) error {
} }
func (s *Session) clsHandler(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 cmd := "clear"
// cleared if a "clear; net.show" commands chain is executed if runtime.GOOS == "windows" {
// in the interactive session. cmd = "cls"
for i := 0; i < 180; i++ {
fmt.Println()
} }
readline.ClearScreen(s.Input.Stdout())
c := exec.Command(cmd)
c.Stdout = os.Stdout
c.Run()
return nil return nil
} }