readline
readline copied to clipboard
Left arrow is not working when running via serial (picocom, minicom)
Using this example i was able to trigger a bug with pressing the left arrow:
package main
import (
"fmt"
"github.com/chzyer/readline"
)
func main() {
l, err := readline.New("> ")
if err != nil {
panic(err)
}
defer l.Close()
for {
line, err := l.Readline()
if err != nil {
break
}
fmt.Println("You typed:", line)
}
}
Steps to reproduce:
Connect to a device via a serial console (tried with both picocom and minicom). Run the program above. Hit left arrow, nothing happens. OK.
Enter a letter or multiple letters. Press left arrow. Line is cleared and no input possible. BUG. Program has to be killed from another session or the device has to be rebootet to revive the serial connection.
if cross compilation is needed, for example: CGO_ENABLED=0 GOARCH=arm GOARM=5 go build -ldflags="-w -s" -trimpath -o .
EDIT: Left arrow works fine when used via SSH.