Skip to content
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

iloop when using ammonite for the scala repl with pantsd #5223

Open
stuhood opened this issue Dec 18, 2017 · 5 comments
Open

iloop when using ammonite for the scala repl with pantsd #5223

stuhood opened this issue Dec 18, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@stuhood
Copy link
Member

@stuhood stuhood commented Dec 18, 2017

Adding an ammonite target like:

jar_library(name = 'ammonite', jars = [jar(org='com.lihaoyi', name='ammonite_2.11.11', rev='1.0.0-RC9')])

And then using it with the daemon:

./pants --pants-config-files=pants.daemon.ini repl.scala --main='ammonite.Main' //:ammonite

...triggers an infinite loop containing:

bash: /dev/tty: Device not configured
bash: /dev/tty: Device not configured
java.lang.RuntimeException: Nonzero exit value: 1
  scala.sys.package$.error(package.scala:27)
  scala.sys.process.ProcessBuilderImpl$AbstractBuilder.slurp(ProcessBuilderImpl.scala:132)
  scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang$bang(ProcessBuilderImpl.scala:102)
  ammonite.terminal.TTY$.stty(Utils.scala:118)
  ammonite.terminal.TTY$.init(Utils.scala:97)
  ammonite.terminal.Terminal$.x$1$lzycompute$1(Terminal.scala:41)
  ammonite.terminal.Terminal$.x$1$1(Terminal.scala:41)
  ammonite.terminal.Terminal$.initialConfig$lzycompute$1(Terminal.scala:41)
  ammonite.terminal.Terminal$.initialConfig$1(Terminal.scala:41)
  ammonite.terminal.Terminal$.readLine(Terminal.scala:52)
  ammonite.repl.AmmoniteFrontEnd.readLine(AmmoniteFrontEnd.scala:113)
  ammonite.repl.AmmoniteFrontEnd.action(AmmoniteFrontEnd.scala:25)
  ammonite.repl.Repl$$anonfun$action$2.apply(Repl.scala:140)
  ammonite.repl.Repl$$anonfun$action$2.apply(Repl.scala:132)
  ammonite.util.Catching.flatMap(Res.scala:109)
  ammonite.repl.Repl.action(Repl.scala:132)
  ammonite.repl.Repl.loop$1(Repl.scala:172)
  ammonite.repl.Repl.run(Repl.scala:186)
  ammonite.Main$$anonfun$run$2.apply(Main.scala:191)
  ammonite.Main$$anonfun$run$2.apply(Main.scala:178)
  scala.Option.getOrElse(Option.scala:121)
  ammonite.Main.run(Main.scala:178)
  ammonite.MainRunner$$anonfun$runRepl$1.apply(Main.scala:355)
  ammonite.MainRunner$$anonfun$runRepl$1.apply(Main.scala:355)
  ammonite.MainRunner.watchLoop(Main.scala:336)
  ammonite.MainRunner.runRepl(Main.scala:355)
  ammonite.Main$.main0(Main.scala:277)
  ammonite.Main$.main(Main.scala:241)
  ammonite.Main.main(Main.scala)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.lang.reflect.Method.invoke(Method.java:498)
  org.pantsbuild.tools.runner.PantsRunner.runMainMethod(PantsRunner.java:98)
  org.pantsbuild.tools.runner.PantsRunner.main(PantsRunner.java:42)
@stuhood stuhood added this to the Daemon Beta milestone Dec 18, 2017
@stuhood

This comment has been minimized.

Copy link
Member Author

@stuhood stuhood commented Dec 18, 2017

...even more fun: it appears that when you Ctrl+C out of this loop it will continue running in the background.

@stuhood stuhood modified the milestones: Daemon Beta, 1.4.x Dec 19, 2017
@stuhood

This comment has been minimized.

Copy link
Member Author

@stuhood stuhood commented Jan 12, 2018

Given the discoveries on #5174, this seems likely to be related. cc @kwlzn

@stuhood stuhood modified the milestones: 1.4.x, Daemon Beta Jan 12, 2018
@kwlzn

This comment has been minimized.

Copy link
Member

@kwlzn kwlzn commented Jan 26, 2018

relates to lihaoyi/Ammonite#276

according to that ticket, it seems like jline2 strictly relies on reading /dev/tty which presumably isn't plumbed properly by the OS in the remote pantsd-runner case.

there may be a trick or two we can try here to get /dev/tty setup correctly in lieu of this tho. will take a closer look.

@kwlzn kwlzn self-assigned this Jan 26, 2018
@kwlzn

This comment has been minimized.

Copy link
Member

@kwlzn kwlzn commented Jan 26, 2018

...even more fun: it appears that when you Ctrl+C out of this loop it will continue running in the background.

this part seems to be fixed by #5352, at least

@stuhood

This comment has been minimized.

Copy link
Member Author

@stuhood stuhood commented Mar 15, 2019

At this point, I think that we're 98% certain that this is just ammonite, rather than the custom main in particular.

@stuhood stuhood changed the title iloop when using a custom `--main` for the scala repl with pantsd iloop when using ammonite for the scala repl with pantsd Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.