Skip to content

Ensure scala-cli.sh logs to stderr#4301

Open
alexarchambault wants to merge 4 commits into
VirtusLab:mainfrom
alexarchambault:launcher-stderr
Open

Ensure scala-cli.sh logs to stderr#4301
alexarchambault wants to merge 4 commits into
VirtusLab:mainfrom
alexarchambault:launcher-stderr

Conversation

@alexarchambault

Copy link
Copy Markdown
Contributor

This makes the scala-cli.sh script send the messages it prints to stderr rather than stdout. These messages could be a problem if users pipe the output of a scala-cli command to a file or to another command.

This also fixes an undefined command (echoerr, which is undefined) in the script in some cases, and makes it respect COURSIER_CACHE in the env if it's set.

Checklist

  • tested the solution locally and it works
  • ran the code formatter (scala-cli fmt .)
  • ran scalafix (./mill -i __.fix)
  • ran reference docs auto-generation (./mill -i 'generate-reference-doc[]'.run)

How much have your relied on LLM-based tools in this contribution?

LLM tools were used to write a first version of the added integration tests. These have been tweaked manually after that.

How was the solution tested?

Manually + added integration tests

alexarchambault and others added 4 commits June 3, 2026 16:42
So that this doesn't polute the output of a scala-cli command, if users
pipe it to a file or another command for example
Verify the launcher's own messages (e.g. "Downloading ...") go to
stderr rather than stdout, so that only the dummy app's output ends up
on stdout - both on a cold cache (when the launcher gets downloaded)
and on a warm one. The script path is passed in from the build via
forkEnv, and COURSIER_CACHE is pointed at a fresh per-test directory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexarchambault alexarchambault changed the title Launcher stderr Ensure scala-cli.sh logs to stderr Jun 4, 2026
@alexarchambault

This comment was marked as outdated.

@alexarchambault alexarchambault marked this pull request as ready for review June 4, 2026 13:28
@alexarchambault

Copy link
Copy Markdown
Contributor Author

(Seems the CI error aren't related to those changes, right?)

@Gedochao

Gedochao commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

(Seems the CI error aren't related to those changes, right?)

likely a flake, I restarted it just now

@Gedochao Gedochao self-requested a review June 7, 2026 11:29
expect(!hasCachedLaunchers(cache))

def runLauncher(): os.CommandResult =
os.proc(launcherScript, "run", "--server=false", appRelPath).call(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why --server=false here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes the test download less things (Bloop, maybe a JVM specifically for it too), that we're not interested in testing here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants