|
I have seen in a few scripts -- e.g. that run on GitHub Actions -- people invoke sbt like this: cat /dev/null | sbt scalafmtCheckIs this necessary? Various LLMs seem convinced that this is a good idea because it forces sbt to run in non-interactive mode. But sbt seems to work fine without the As long as you are passing some arguments to sbt, I understand that it will run in batch mode and these hacks are just noise. Is that correct, or am I missing something? |
Replies: 1 comment 2 replies
Thanks for this question. Unfortunately, the magical incantation is useful in some situation. It depends who the target user is here, specifically when there's a typo or a mistake in $ sbt test
[info] welcome to sbt 1.12.11 (Azul Systems, Inc. Java 17.0.18)
[info] loading project definition from /private/tmp/aaa/project
[error] [/private/tmp/aaa/build.sbt]:1: '=' expected but eof found.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r) << waits herePiping $ cat /dev/null | sbt test
[info] welcome to sbt 1.12.11 (Azul Systems, Inc. Java 17.0.18)
[info] loading project definition from /private/tmp/aaa/project
[error] [/private/tmp/aaa/build.sbt]:1: '=' expected but eof found.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
$ << you get the prompt backThis might be helpful if Claude etc is often generating some mistake and correcting itself by looking at the error. Without out it the subagent/subprocess would get stuck. There's a built-in option called $ sbt test --batch
[info] welcome to sbt 1.12.11 (Azul Systems, Inc. Java 17.0.18)
[info] loading project definition from /private/tmp/aaa/project
[error] [/private/tmp/aaa/build.sbt]:1: '=' expected but eof found.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
$If enough people are using LLM with sbt, maybe we should make |
Thanks for this question. Unfortunately, the magical incantation is useful in some situation. It depends who the target user is here, specifically when there's a typo or a mistake in
build.sbtfile. By default,sbt testetc (not justscalafmtCheckbut any task/command) would helpfully block the system prompt asking if the user wants to restart.P…