如何获得程序的无缓冲输入?

Ste*_*ieD 6 raku

我不知道如何获得无缓冲的输入。

我试过:

    method get-selection() {
        getc();
    }
Run Code Online (Sandbox Code Playgroud)

还尝试了 Term::ReadKey 模块:

use Term::ReadKey;
    method get-selection() {
        read-key();
    }
Run Code Online (Sandbox Code Playgroud)

但我仍然必须按 Enter 键才能捕获输入。在文档中找不到任何可能有帮助的内容。

我在 macOS 上。

Eli*_*sen 3

https://docs.raku.org/type/IO::Handle#routine_getc指出:

仅当您将终端设置为“无缓冲”时,使用 getc 从终端获取单个按键才能正常工作。

对于 MacOS,Google 搜索可以让我:

https://apple.stackexchange.com/questions/193138/to-install-unbuffer-in-osx

  • 好的,但是如果这是一台我无法控制的计算机怎么办?我希望模块以同样的方式工作。 (2认同)
  • 嗯...正在调查中:https://irclogs.raku.org/moarvm/2022-06-17.html#12:02 (2认同)