Closed lead8000 closed 8 months ago
Yes, because Air listens for events like Ctrl-C, if we support passing input to our program, it will also pass Ctrl-C to our program
arelo supports stdin passing. In addition, Ctrl-C works well.
$ arelo -- go run .
2023/05/31 22:57:37 [ARELO] start: go run .
Enter your name: myName
Hello, myName
2023/05/31 22:57:45 [ARELO] command exit status 0
^C2023/05/31 22:57:50 [ARELO] signal: interrupt
$
stdio still doesn't work, The following code will return err "EOF" and not read from the stdio the response
fmt.Println("Are you sure? (yes/no)")
reader := bufio.NewReader(os.Stdin)
response, err := reader.ReadString('\n')
if err != nil {
log.Fatalln("Error reading input:", err)
return
}
This is a small example that shows the issue. Here is the source code:
This is the result of running it with
air
. Waits to print, but never prints:And this is the result of running it without
air
: