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

watcher? output doesn't respect output level flags (running commands with tilde ~) #7355

Open
RobertSandiford opened this issue Aug 13, 2023 · 4 comments
Labels
area/watch Issues around ~ (triggered execution, watch) Bug good first issue

Comments

@RobertSandiford
Copy link

context

build.sbt: scalaVersion := "3.3.0"
sbt v1.9.3
Running in PowerShell in VS Code

steps

run sbt -error ~run

problem

Non error output that looks to come from the "watcher" is displayed

PS C:\MainFiles\ScalaDocs\hello-world> sbt -error ~run
Hello, World!
[info] 1. Monitoring source files for hello-world/run...
[info] Press to interrupt or '?' for more options.
[info] Build triggered by C:\MainFiles\ScalaDocs\hello-world\src\main\scala\Main.scala. Running 'run'.
Hello, World!
[success] Total time: 7 s, completed 13 Aug 2023, 18:12:13
[info] 2. Monitoring source files for hello-world/run...
[info] Press to interrupt or '?' for more options.

expectation

There would be no output aside from program output and errors.

notes

For reference here is the full output without -error. The first run [success] is not printed, but "watcher" output and subsequent [success]s are - I am guess that the task is run once and conforms, but the watcher spins up in a separate "thread", and performs subsequent runs non comformantly. (Output that is printed above in bold.)

PS C:\MainFiles\ScalaDocs\hello-world> sbt ~run
[info] welcome to sbt 1.9.2 (Amazon.com Inc. Java 18.0.2)
[info] loading settings for project hello-world-build-build from metals.sbt ...
[info] loading project definition from C:\MainFiles\ScalaDocs\hello-world\project\project
[info] loading settings for project hello-world-build from metals.sbt ...
[info] loading project definition from C:\MainFiles\ScalaDocs\hello-world\project
[success] Generated .bloop\hello-world-build.json
[success] Total time: 2 s, completed 13 Aug 2023, 18:05:59
[info] loading settings for project hello-world from build.sbt ...
[info] set current project to hello-world (in build file:/C:/MainFiles/ScalaDocs/hello-world/)
[info] sbt server started at local:sbt-server-f0eed868f6240def273b
[info] started sbt server
[info] running Main
Hello, World!
[success] Total time: 2 s, completed 13 Aug 2023, 18:06:03
[info] 1. Monitoring source files for hello-world/run...
[info] Press to interrupt or '?' for more options.
[info] Build triggered by C:\MainFiles\ScalaDocs\hello-world\src\main\scala\Main.scala. Running 'run'.
[info] compiling 1 Scala source to C:\MainFiles\ScalaDocs\hello-world\target\scala-3.3.0\classes ...
[info] running Main
Hello, World!
[success] Total time: 7 s, completed 13 Aug 2023, 18:06:17
[info] 2. Monitoring source files for hello-world/run...
[info] Press to interrupt or '?' for more options.

Also tested with ~compile and -warn

PS C:\MainFiles\ScalaDocs\hello-world> sbt -error ~compile
[info] 1. Monitoring source files for hello-world/compile...
[info] Press to interrupt or '?' for more options.
[info] Build triggered by C:\MainFiles\ScalaDocs\hello-world\src\main\scala\Main.scala. Running 'compile'.
[success] Total time: 7 s, completed 13 Aug 2023, 17:50:33
[info] 2. Monitoring source files for hello-world/compile...
[info] Press to interrupt or '?' for more options.

PS C:\MainFiles\ScalaDocs\hello-world> sbt -warn ~run
Hello, World!
[info] 1. Monitoring source files for hello-world/run...
[info] Press to interrupt or '?' for more options.
[info] Build triggered by C:\MainFiles\ScalaDocs\hello-world\src\main\scala\Main.scala. Running 'run'.
Hello, World!
[success] Total time: 7 s, completed 13 Aug 2023, 18:13:40
[info] 2. Monitoring source files for hello-world/run...
[info] Press to interrupt or '?' for more options.

@RobertSandiford RobertSandiford changed the title watcher? output doesn't respect output level flags watcher? output doesn't respect output level flags (running commands with tilde ~) Aug 13, 2023
@SethTisue
Copy link
Member

Note that the same thing happens if you do everything interactively rather than passing args to sbt:

sbt:euler> error
sbt:euler> ~run
hi
[success] Total time: 0 s, completed Aug 13, 2023, 3:46:26 PM
[info] 1. Monitoring source files for euler/run...
[info]    Press <enter> to interrupt or '?' for more options.

@eed3si9n eed3si9n added the area/watch Issues around ~ (triggered execution, watch) label Aug 14, 2023
@eed3si9n
Copy link
Member

@RobertSandiford Thanks for the bug report with details. I ack this is a bug.

@eed3si9n
Copy link
Member

Likely relevant line:

watchLogLevel :== Level.Info,

@angry-werner
Copy link

Hello, I'm new here and I might give it a try to solve it. Deleting the above mentioned line solves the problem at first sight, but I couldn't yet follow the code enough with the debugger to determine if this is the right solution (Hi @adpi2 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/watch Issues around ~ (triggered execution, watch) Bug good first issue
Projects
None yet
Development

No branches or pull requests

4 participants