LoginSignup
5
5

More than 5 years have passed since last update.

leiningenで標準入力を扱う場合

Posted at

これまたはまったのでメモ。leiningenは大変便利ですが、stdinを扱うような場合に注意が必要です。特に何も考えずにstdinを扱うようなプログラムをlein runするとずっと入力待ちになってしまいます。公式のページのほうにも

There's a problem in the library that Leiningen uses to spawn new processes that blocks access to console input. This means that functions like read-line will not work as expected in most contexts, though the repl task necessarily includes a workaround.

とあるのにしばらくしてから気づきましたorz。解決方法としてはlein trampoline runなどとやればよいようです。プログラム側への変更は特に必要ないっぽい。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5