Search code examples
rakuonkeypress

How can I respond to a key press, without a CRLF, in Raku?


I would like to implement:

Press any key to continue...

That responds to, well, any key without pressing the Return or Enter key.

Term::ReadKey does not implement this behavior. It requires a CRLF.

I'm using iTerm2.

[19] > $*KERNEL
darwin
[20] > $*DISTRO
macos (13.0.1)
[21] > $*RAKU
Raku (6.d)
[22] > $*VM
moar (2022.12)

Solution

  • I think you will have to use a module to be able to do that in Raku. Term::termios comes to mind.