From 3d1b0903595178468f5cec0d8f3ed296cb4b03b3 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 28 Aug 2016 16:58:24 +0300 Subject: [PATCH] fix wait key command for posix shells --- app.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index 6f81a93..b8cf567 100644 --- a/app.go +++ b/app.go @@ -16,7 +16,15 @@ type App struct { func waitKey() error { // TODO: this should be done with termbox somehow - cmd := exec.Command(gOpts.shell, "-c", "echo; echo -n 'Press any key to continue'; stty -echo; read -n 1; stty echo; echo") + c := `echo + echo -n 'Press any key to continue' + old=$(stty -g) + stty raw -echo + eval "ignore=\$(dd bs=1 count=1 2> /dev/null)" + stty $old + echo` + + cmd := exec.Command(gOpts.shell, "-c", c) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout