mill icon indicating copy to clipboard operation
mill copied to clipboard

mill is unable to run in tty-less environments (e.g. cronjobs, in background)

Open edwardcwang opened this issue 6 years ago • 1 comments

Mill version: 0.3.5

Thank you very much for this great build tool! 👍

When running mill in a tty-less environment, something within mill using JLine tries to change tty/terminal settings via stty which doesn't play well with tty-less environments/background execution such as cronjobs, nohup, buildbot, etc.

As soon as what appears to be scalac is about to run (as mill can print out its own informational messages fine), stty is invoked (via what looks like JLine) to change terminal settings and the process receives SIGTTOU which causes it to hang in tty-less environments.

The same build works fine in an interactive shell. It can be worked around by using a mock stty though it would be good if there were a flag to disable JLine or tty interaction for batch jobs.

For example, one might expect mill to be able to run in the background in non-interactive mode as below instead of hanging/being stopped.

$ mill <myproject>.assembly &
[1] 13337
[...]

[1]+  Stopped                 ./mill <myproject>.assembly
$ jobs -l
[1]+ 13337 Stopped (tty input)     ./mill <myproject>.assembly

Some relevant links:

  • https://www.unix.com/shell-programming-and-scripting/131516-stty-error-when-script-called-out-cronjob.html
  • http://curiousthing.org/sigttin-sigttou-deep-dive-linux

edwardcwang avatar Mar 08 '19 01:03 edwardcwang

This looks like it's related to https://github.com/lihaoyi/Ammonite/issues/956

Baccata avatar Jun 16 '19 08:06 Baccata