-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for
runBackground
mutex and log management (#3971)
Fixes #3955. * We make `runBackground` forward the stdout/stderr to `$serverDir/{stdout,stderr}` instead of `os.Inherit`. This is necessary because since we started using com-lihaoyi/os-lib@59b5fd9, `os.Inherit` is automatically pumped to the enclosing task logger, which for `runBackground` ends up being closed immediately so the logs are lost. * Now, the logs are instead picked up asynchronously by the `FileToStreamTailer` infrastructure, which picks them up and forwards them to any connected client regardless of who started the runBackground process * Moved usage of `FileToStreamTailer` from the mill client to the server. * This allows better integration with the Mill logging infrastructure, e.g. ensuring tailed logs properly interact with the multi-line prompt by clearing the prompt before being printed and re-printing the prompt after. * Simplified `BackgroundWrapper` * Renamed it `MillBackgroundWrapper` so it's more clear what it is when seen in `jps` * Use a file-lock for mutex, rather than polling on the process uuid/tombstone files * We still need to add a `Thread.sleep` after we take the lock, because the prior process seems to still hold on to sockets for some period of time. This defaults to 500ms (what is necessary experimentally) but is configurable by the new `runBackgroundRestartDelayMillis: T[Int]` task * Generally unified the creation/shutdown logic within `MillBackgroundWrapper`, rather than having it split between `BackgroundWrapper` and `def backgroundSetup` in the Mill server process Tested manually by running `rm -rf out && /Users/lihaoyi/Github/mill/target/mill-release -w runBackground` inside `example/javalib/web/1-hello-jetty`. Forced updates via `Enter` in the terminal or via editing server source files. Verified that the `runBackground` server logs appear in the console and that they do not conflict with the multi-line status prompt
- Loading branch information
Showing
15 changed files
with
272 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.