The problem stems from /dev/tty pointing to the current TTY, but JLine2 uses the real TTY rather than creating a pseudo-terminal. If you execute from a terminal, you're fine, but a background process will cause problems.
Since the replFrege task starts a new background process, I have the following options:
Upgrading to jline3 may solve the issue since it uses pseudo-terminals.
Wrapping the gradle task with rlwrap seems to work on macOS/linux: https://github.com/mrsarm/jshell-plugin/issues/5
On windows however, it works without it. I don't like to introduce conditional changes.
Execute the FregeRepl directly in the console without Gradle. Use grade only to get the classpath with all the dependencies.
Problem
Arrow Functions do not work on macOS/Linux in
replFrege
task. See https://github.com/gradle/gradle/issues/4982.Unfortunately Gradle has only little support for feeding inputs to a task through a terminal. This is a known problem:
Update: It seems that in my case the problem may not be a combination of gradle and jline2: According to this issue https://github.com/com-lihaoyi/Ammonite/issues/276#issuecomment-272768398:
Since the replFrege task starts a new background process, I have the following options:
rlwrap
seems to work on macOS/linux: https://github.com/mrsarm/jshell-plugin/issues/5 On windows however, it works without it. I don't like to introduce conditional changes.