Skip to content

Commit

Permalink
Don't chdir at toplevel
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremie Dimino <[email protected]>
  • Loading branch information
jeremiedimino committed Sep 29, 2021
1 parent 957a059 commit b372342
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
20 changes: 9 additions & 11 deletions test/expect-tests/dune_file_watcher/dune_file_watcher_tests_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ let printf = Printf.printf
open Base
open Stdune

let tmp_dir = Stdlib.Filename.concat (Unix.getcwd ()) "working-dir"

let () =
try Unix.mkdir tmp_dir 0o777 with
| _ -> ()

let () = Unix.chdir tmp_dir

let () = Path.set_root (Path.External.of_string tmp_dir)

let () = Path.Build.set_build_dir (Path.Build.Kind.of_string "_build")
let init () =
let tmp_dir = Stdlib.Filename.concat (Unix.getcwd ()) "working-dir" in
let () =
try Unix.mkdir tmp_dir 0o777 with
| _ -> ()
in
Unix.chdir tmp_dir;
Path.set_root (Path.External.of_string tmp_dir);
Path.Build.set_build_dir (Path.Build.Kind.of_string "_build")

let now () = Unix.gettimeofday ()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
open Stdune
open Dune_file_watcher_tests_lib

let%expect_test _ = init ()

let%expect_test _ =
let mutex = Mutex.create () in
let critical_section ~f =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
open Stdune
open Dune_file_watcher_tests_lib

let%expect_test _ = init ()

let%expect_test _ =
let mutex = Mutex.create () in
let critical_section ~f =
Expand Down

0 comments on commit b372342

Please sign in to comment.