-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--interactive should not close the terminal after piping Scala code #2185
Comments
Hi @bphenriques I sorry for the delayed response. I think I've found a potential solution to your issue. Try running the following command:
The trick here is using the |
Unfortunately, the above trick with cat works only with Scala 2. For Scala 3, it throws the following error:
|
@lwronski thank you! I will try out once I got back from my holidays and I will let you know Intuitively, shouldn't |
Attempted to run the Scala 2 version and it partially worked:
Edit: Regarding Scala 3, I have the same output. |
@bphenriques inserting |
sbt can do this with something similar to this in your build.sbt:
Now when you type console in sbt the REPL executes this stuff before you can continue with your REPL experiments, so it is possible also for Scala 3 to make this work already today without updating the compiler. I think this is a very useful use case for scala-cli |
The way I see, this ticket is somewhat conflating two different concerns unintentionally (my bad):
I would be content if 1. was addressed as it is good enough for me (I can create an wrapper) for it. I may have ideas for 2. but it might be preferable to discuss over the other issue given that it is an API concern - up to the maintainers. |
I also think that it's tricky. So, I believe it's reasonable to limit this issue to only adding support for |
Renamed this to ensure it's clear the current requirements are separate from #2732 |
Perhaps there can be a scala-cli option that forces a "dumb" jline or similar so that it at least does not crash when piping? |
For reference: here is an example by @mpollmeier of how the repl can be used for piping: |
@bjornregnell @mbovel Likely this is the same as scala/scala3#11978 |
Version(s) 1.0.0
Describe what needs to be done and why
I want to automate a repl that has several libs and imports by default.
My current ammonite setup:
Which makes it very easy to have a quick typelevel repl by calling
load.fs2
.I am trying to replace ammonite for scala-cli, so I am exploring existing command line options for the same purpose, however the terminal exits right away.
I am unsure if this is a bug, but it seems to be. I may be using
scala-cli
incorrectly, hence my request for feedback.Is your feature request related to a past ticket or discussion?
AFAIK no.
Describe alternatives you've considered
It won't change much, but I considering moving the Scala code to a file and piping the file to
scala-cli
.The text was updated successfully, but these errors were encountered: