-
Notifications
You must be signed in to change notification settings - Fork 470
clear-on-rebuild should clear the console before the initial build #6884
Description
The first time I ran dune build --watch after upgrading past the change to the default --terminal-persistence setting, seeing the terminal clear on rebuild was jarring and extremely unpleasant. I think the shock came from the fact that the initial build just gets output to the console, so when the console gets cleared on rebuild it seems to come out of nowhere. "Oh, you did NOT just mess with MY CONSOLE" was my gut reaction (strong enough that I immediately looked for how to turn it off permanently and compiled my own Dune when man dune-config showed no such setting).
Desired Behavior
If dune build --watch started by clearing the console before performing the initial build, this would properly set expectations: This is a "full-screen" ncurses-style program that updates its display in place. Now it's perfectly natural that it clears the screen - which already contains only Dune's own output - when it rebuilds.
If it seems paradoxical that clearing the terminal more would have angered me less, consider that it would have happened when I was still paying direct attention to the console in a moment when I still felt in control, rather than happening minutes later when I least expected it. It's not surprising for a command to begin by clearing the screen - man, less, etc. do this all the time - but it's very surprising for a command to do so for the first time, on its own, several minutes after it had completely started up.
Example
$ dune build --watch
(screen clears)
File "ocaml/file_formats/cmi_format.mli", line 36, characters 53-54:
Error: Syntax error
File "ocaml/lambda/translmod.mli", line 44, characters 0-3:
Error: Syntax error
Had errors, waiting for filesystem changes...
(file changes, screen clears again)
File "ocaml/lambda/translmod.mli", line 44, characters 0-3:
Error: Syntax error
Had errors, waiting for filesystem changes...