Closed gkepka closed 1 month ago
The
scala-cli
part needs some attention. While code compiles and starts without any problems, the process end immediately after being started. In SBT the same problem can be solved by settingfork := true
, but I wasn't able to find any similar solution forscala-cli
.
In order to troubleshoot and isolate the problem: have you tried adding a while (true) {}
loop at the end of main
?
The problem with scala-cli
turned out to be caused by the difference between how files with .sc
and .scala
extensions are handled. It turns out that while the .scala
files are executed as written, the contents of .sc
files are wrapped in an auto-generated main
function, ignoring all main
functions defined in the code. The documentation for scala-cli
makes a very good job at hiding that distinction, I managed to find it descibed here.
The
scala-cli
part needs some attention. While code compiles and starts without any problems, the process end immediately after being started. In SBT the same problem can be solved by settingfork := true
, but I wasn't able to find any similar solution forscala-cli
.