diff --git a/internal/frame/stream.go b/internal/frame/stream.go index f5c2bdeb..c135d19a 100644 --- a/internal/frame/stream.go +++ b/internal/frame/stream.go @@ -103,13 +103,7 @@ func (stream *CmdStreamConsole) ReadLine(ctx context.Context) (context.Context, for { disabler := colorable.EnableColorsStdout(nil) clean, err2 := consoleicon.SetFromExe() - for { - line, err = stream.readLineContinued(ctx) - if err != readline.CtrlC { - break - } - fmt.Fprintln(os.Stderr, err.Error()) - } + line, err = stream.readLineContinued(ctx) if err2 == nil { clean(false) } diff --git a/internal/shell/loop.go b/internal/shell/loop.go index 7c42b11a..2781e7ba 100644 --- a/internal/shell/loop.go +++ b/internal/shell/loop.go @@ -7,6 +7,8 @@ import ( "os" "os/signal" "syscall" + + "github.com/nyaosorg/go-readline-ny" ) // Stream is the inteface which can read command-line @@ -96,6 +98,10 @@ func (sh *Shell) Loop(ctx0 context.Context, stream Stream) (int, error) { if err == io.EOF { return 0, err } + if err == readline.CtrlC { + fmt.Fprintln(os.Stderr, err.Error()) + continue + } return 1, err }