Hello. I don't know if I'm doing something wrong, but the following program makes my CPU spin at 100% before I give it any input. I'm on an M1 MacBook Pro
app "cli-tutorial"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.0/bkGby8jb0tmZYsy2hg1E_B2QrCgcSTxdUlHtETwm5m4.tar.br" }
imports [pf.Stdout, pf.Stdin, pf.Task]
provides [main] to pf
main =
Task.await Stdin.line \input ->
when input is
Input i -> Stdout.line i
End -> Stdout.line "No input"
huh, that's surprising!
so the program otherwise behaves as expected? (Aside from the 100% CPU before you enter an inputs)
Wait, I spoke too soon. It is only when running it with the single command roc. No arguments.
And yes, apart from that the program behaves as expected
roc dev too
roc run main.roc or running the binary from roc build main.rocworks as expected. It's only the two invocations above
Summing up, it is a problem, but only when running roc or roc dev in a folder with a main.roc file with the contents above.
When running roc run main.roc or running the binary from roc build main.roc, the behaviour is as expected and the CPU does not spin.
I made #6181 for this.
I probably broke this
Not exactly sure how, but I think roc is waiting on the application to let it know that it has finished
This is related to roc waiting for dbg and expect messages
Maybe when I removed the dbg messages, I accidentally removed sending the termination message
Last updated: Dec 21 2025 at 12:15 UTC