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

Clear console before running command in exec -w #10983

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gridbugs
Copy link
Collaborator

@gridbugs gridbugs commented Oct 1, 2024

This fixes an issue where the build progress stays on the console after the build completes, and the first line of the output of the command being exec'd is printed on teh same line as the build progress.

A side effect of this change is that some of the "Build Successful" messages in tests get truncated.

Fixes #10922

@gridbugs gridbugs requested a review from emillon October 1, 2024 08:53
@@ -10,16 +10,16 @@ between each change to its code.
> EOF

$ dune exec --watch ./foo.exe &
Success, waiting for filesystem changes...
changes...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does it remove the entire sentence, minus the last word, here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No idea! It only happens in cram tests - not when running dune from a terminal. I've tried various Console functions to see if I could fix the test behaviour while also maintaining the behaviour when you run the command interactively but nothing works. Maybe something to do with how cram tests capture the output of commands? @rgrinberg any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

No idea, sorry. But shouldn't you restore the terminal after the process finishes?

This fixes an issue where the build progress stays on the console after
the build completes, and the first line of the output of the command
being exec'd is printed on teh same line as the build progress.

A side effect of this change is that some of the "Build Successful"
messages in tests get truncated.

Signed-off-by: Stephen Sherratt <[email protected]>
|> Fiber.map
~f:
(Result.map ~f:(fun prog ->
Console.reset ();
Copy link
Collaborator

@Alizter Alizter Oct 25, 2024

Choose a reason for hiding this comment

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

Rather than doing this directly, let's be consistent with dune build watch mode.

Suggested change
Console.reset ();
Scheduler.maybe_clear_screen ~details_hum:[] config;

You will need to thread config from run_eagar_watch.

@Alizter
Copy link
Collaborator

Alizter commented Oct 25, 2024

Are we aware that all the exec-watch tests are disabled? i.e. (enable_if false).

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.

Missing newline in "dune exec -w"
4 participants