Skip to content

Commit

Permalink
binfmt register: Fix getting exe path when calling wasmer from $PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaesar committed Jan 7, 2022
1 parent a9da483 commit 248735c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/cli/src/commands/binfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ impl Binfmt {
Register | Reregister => {
temp_dir = tempfile::tempdir().context("Make temporary directory")?;
seccheck(temp_dir.path())?;
let bin_path_orig: PathBuf = env::args_os()
.nth(0)
.map(Into::into)
.filter(|p: &PathBuf| p.exists())
let bin_path_orig: PathBuf = env::current_exe()
.and_then(|p| p.canonicalize())
.context("Cannot get path to wasmer executable")?;
let bin_path = temp_dir.path().join("wasmer-binfmt-interpreter");
fs::copy(&bin_path_orig, &bin_path).context("Copy wasmer binary to temp folder")?;
Expand Down

0 comments on commit 248735c

Please sign in to comment.