`--display=quiet` has no effect on `--root`-changing messages
Expected Behavior
dune build --root=foo/bar blah --display=quiet should be quiet
Actual Behavior
dune build --root=foo/bar blah --display=quiet displays both Entering diretory 'foo/bar' and Leaving directory 'foo/bar' messages.
Reproduction
diff --git a/test/blackbox-tests/test-cases/quiet-root.t b/test/blackbox-tests/test-cases/quiet-root.t
new file mode 100644
index 000000000..4bf5017a5
--- /dev/null
+++ b/test/blackbox-tests/test-cases/quiet-root.t
@@ -0,0 +1,21 @@
+Document how Dune displays various things
+=========================================
+
+ $ echo '(lang dune 3.0)' > dune-project
+ $ export BUILD_PATH_PREFIX_MAP=SH=`command -v sh`
+
+Errors with location embed in their output
+------------------------------------------
+
+ $ mkdir foo/
+ $ cat >foo/dune-project<<"EOF"
+ > (lang dune 3.16)
+ > (package (name foo))
+ > EOF
+
+ $ dune build --root=foo/ @fmt
+ Entering directory 'foo'
+ Leaving directory 'foo'
+ $ dune build --root=foo/ @fmt --display=quiet
+ Entering directory 'foo'
+ Leaving directory 'foo'
Specifications
- Version of
dune(output ofdune --version): 3.19.1 - Version of
ocaml(output ofocamlc --version): 4.14.0 - Operating system (distribution and version): linux, debian
I think we need these silly markers for programs like emacs to recognize dune's error message when they're relative to the root directory. This all comes from a convention from make that everybody's tooling latched on.
I'm not opposed to a flag that gets rid of this, but I do think it needs to stick around by default.
if it's to accompany other error messages then one possibility I hadn't considered is that --display=quiet could make the entering/leaving messages only appear if there are error messages (so produce them lazily, only if needed).
I don't mind too much if there is some stuff displayed in case of an error.
There's already --no-print-directory to suppress these messages. Producing them lazily has been discussed before, but I don't really remember why we haven't gone for this. I suppose I would accept a patch that did this if it wasn't very complicated.
Would you accept a patch that would set --no-pront-directory if --display=quiet is passed?
it seems more reasonable ux to me (but maybe that's more personal taste)
@raphael-proust I can make the messages lazy if that satisfies your need. i.e. only print entering/leaving when there is something to print.