Skip to content

Commit

Permalink
fix(boot): fix env vars when finding out concurrency
Browse files Browse the repository at this point in the history
We were passing an empty enviornment to Unix.open_process_full_cmd
before. We now pass the full available Unix.environment since we are
only querying the concurrency by calling nproc or getconf.

On NixOS this was causing the bootstrap to default to a single
processor since nproc wasn't available in the empty environment.

<!-- ps-id: d620baf8-5e58-4212-8f30-df69780a614b -->

Signed-off-by: Ali Caglayan <alizter@gmail.com>
  • Loading branch information
Alizter committed Mar 11, 2023
1 parent 0cff92b commit 00c38ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased
----------

- Bootstrap: correctly detect the number of processors by allowing `nproc` to be
looked up in `$PATH` (#7272, @Alizter)

- Speed up file copying on macos by using `clonefile` when available
(@rgrinberg, #7210)

Expand Down
2 changes: 1 addition & 1 deletion boot/duneboot.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ let exe = if Sys.win32 then ".exe" else ""

let concurrency =
let try_run_and_capture_line cmd =
let ic, oc, ec = Unix.open_process_full cmd [||] in
let ic, oc, ec = Unix.open_process_full cmd (Unix.environment ()) in
let line =
match input_line ic with
| s -> Some s
Expand Down

0 comments on commit 00c38ea

Please sign in to comment.