Skip to content

Commit

Permalink
Exec watch mode spawns processes with initial cwd
Browse files Browse the repository at this point in the history
Fixes a bug where commands run from `dune exec -w` would have the cwd of
the project root rather than the directory where the command was run.

Signed-off-by: Stephen Sherratt <[email protected]>
  • Loading branch information
gridbugs committed Mar 13, 2024
1 parent c439bec commit 1f97cfb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/exec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ module Command_to_exec = struct
let path = Path.to_string path in
let env = Env.to_unix env |> Spawn.Env.of_list in
let argv = path :: args in
Spawn.spawn ~prog:path ~env ~argv ()
let cwd = Spawn.Working_dir.Path Fpath.initial_cwd in
Spawn.spawn ~prog:path ~env ~cwd ~argv ()
in
Pid.of_int pid
;;
Expand Down

0 comments on commit 1f97cfb

Please sign in to comment.