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

Don't let command run by Dune observe INSIDE_EMACS #4680

Merged
3 commits merged into from Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ Unreleased
- Do not log `live_words` and `free_words` in trace file. This allows using
`Gc.quick_stat` which does not scan the heap. (#4643, @emillon)

- Don't let command run by Dune observe the environment variable
`INSIDE_EMACS` in order to improve reproducibility (#4680,
@jeremiedimino)

2.9.0 (unreleased)
------------------

Expand Down
8 changes: 7 additions & 1 deletion src/dune_rules/global.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ let init ~capture_outputs =
else
Colors.setup_env_for_colors Env.initial
in
Env.add env ~var:"INSIDE_DUNE" ~value:"1")
let env = Env.add env ~var:"INSIDE_DUNE" ~value:"1" in
(* To improve reproducibility, we don't let command executed by Dune
observe whether Dune is run inside emacs or not. One such program that
behave differently when run inside emacs is Dune itself and we sometimes
run Dune from inside Dune, for instnace in cram tests, so it is
important to do this. *)
Env.remove env ~var:"INSIDE_EMACS")

let env () = Fdecl.get env