Skip to content

Commit

Permalink
Pass HOME env var when fetching version (#2698)
Browse files Browse the repository at this point in the history
Fixes #2662.

So, in a github action
https://github.com/mvukov/rules_ros2/blob/980afb82f4af92480815e723b47a0cde4bea63a7/.github/workflows/main.yml
I use my custom build image
https://github.com/mvukov/bazel_builder/blob/49178bdf9c151b1fdb1fb0bac580da5d53a990fd/Dockerfile,
no user defined. The github action passes user and HOME folder. The home
folder seems to be `/github/home` and fetching the version seems to have
problems with this. Therefore, I just pass the HOME env var here.
  • Loading branch information
mvukov authored Dec 4, 2024
1 parent c3d71ed commit a702adf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crate_universe/src/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ impl Digest {
}

pub(crate) fn bin_version(binary: &Path) -> Result<String> {
let safe_vars = [OsStr::new("HOMEDRIVE"), OsStr::new("PATHEXT")];
let safe_vars = [
OsStr::new("HOME"),
OsStr::new("HOMEDRIVE"),
OsStr::new("PATHEXT"),
];
let env = std::env::vars_os().filter(|(var, _)| safe_vars.contains(&var.as_os_str()));

let output = Command::new(binary)
Expand Down

0 comments on commit a702adf

Please sign in to comment.