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

fix: pre-emptively clear screen #6987

Merged
merged 1 commit into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased
----------

- Pre-emptively clear screen in watch mode (#6987, fixes #6884, @rgrinberg)

- Fix cross compilation configuration when a context with targets is itself a
host of another context (#6958, fixes #6843, @rgrinberg)

Expand Down
6 changes: 5 additions & 1 deletion bin/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,11 @@ let init ?log_file c =
Dune_config.adapt_display config
~output_is_a_tty:(Lazy.force Ansi_color.output_is_a_tty)
in
Dune_config.init config;
Dune_config.init config
~watch:
(match c.builder.watch with
| No -> false
| Yes _ -> true);
Dune_engine.Execution_parameters.init
(let open Memo.O in
let+ w = Dune_rules.Workspace.workspace () in
Expand Down
2 changes: 1 addition & 1 deletion bin/subst.ml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ let term =
Path.set_root (Path.External.cwd ());
Path.Build.set_build_dir
(Path.Outside_build_dir.of_string Common.default_build_dir);
Dune_config.init config;
Dune_config.init config ~watch:false;
Log.init_disabled ();
Dune_engine.Scheduler.Run.go
~on_event:(fun _ _ -> ())
Expand Down
7 changes: 6 additions & 1 deletion src/dune_config/dune_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,13 @@ let adapt_display config ~output_is_a_tty =
{ config with terminal_persistence = Terminal_persistence.Preserve }
else config

let init t =
let init t ~watch =
Console.Backend.set (Display.console_backend t.display);
(if watch then
match t.terminal_persistence with
| Preserve -> ()
| Clear_on_rebuild -> Console.reset ()
| Clear_on_rebuild_and_flush_history -> Console.reset_flush_history ());
Log.verbose := t.display.verbosity = Verbose

let auto_concurrency =
Expand Down
2 changes: 1 addition & 1 deletion src/dune_config/dune_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ val load_config_file : Path.t -> Partial.t
val adapt_display : t -> output_is_a_tty:bool -> t

(** Initialises the configuration for the process *)
val init : t -> unit
val init : t -> watch:bool -> unit

val to_dyn : t -> Dyn.t

Expand Down