Skip to content

Commit bf89d33

Browse files
committed
fix: flush stdin buffer before promptYesNo (Telegram prompt skipped)
1 parent c542aee commit bf89d33

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

internal/openclaw/launch.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package openclaw
22

33
import (
4+
"bufio"
45
"encoding/json"
56
"fmt"
67
"os"
@@ -459,8 +460,8 @@ func RunCommand(args ...string) error {
459460
// promptYesNo asks a yes/no question
460461
func promptYesNo(question string) bool {
461462
fmt.Printf("%s (Y/n): ", question)
462-
var answer string
463-
fmt.Scanln(&answer)
463+
reader := bufio.NewReader(os.Stdin)
464+
answer, _ := reader.ReadString('\n')
464465
answer = strings.ToLower(strings.TrimSpace(answer))
465466
return answer == "" || answer == "y" || answer == "yes"
466467
}

0 commit comments

Comments
 (0)