Remove some bad merge code (#252)
This commit is contained in:
parent
9f34c49461
commit
c150d603ea
|
@ -94,33 +94,6 @@ impl CommandExecute for Uninstall {
|
|||
}
|
||||
}
|
||||
|
||||
// During install, `nix-installer` will store a copy of itself in `/nix/nix-installer`
|
||||
// If the user opted to run that particular copy of `nix-installer` to do this uninstall,
|
||||
// well, we have a problem, since the binary would delete itself.
|
||||
// Instead, detect if we're in that location, if so, move the binary and `execv` it.
|
||||
if let Ok(current_exe) = std::env::current_exe() {
|
||||
if current_exe.as_path() == Path::new("/nix/nix-installer") {
|
||||
tracing::debug!(
|
||||
"Detected uninstall from `/nix/nix-installer`, moving executable and re-executing"
|
||||
);
|
||||
let temp = std::env::temp_dir();
|
||||
let temp_exe = temp.join("nix-installer");
|
||||
tokio::fs::copy(¤t_exe, &temp_exe)
|
||||
.await
|
||||
.wrap_err("Copying `nix-installer` to tempdir")?;
|
||||
let args = std::env::args();
|
||||
let mut arg_vec_cstring = vec![];
|
||||
for arg in args {
|
||||
arg_vec_cstring.push(CString::new(arg).wrap_err("Making arg into C string")?);
|
||||
}
|
||||
let temp_exe_cstring = CString::new(temp_exe.to_string_lossy().into_owned())
|
||||
.wrap_err("Making C string of executable path")?;
|
||||
|
||||
nix::unistd::execv(&temp_exe_cstring, &arg_vec_cstring)
|
||||
.wrap_err("Executing copied `nix-installer`")?;
|
||||
}
|
||||
}
|
||||
|
||||
let install_receipt_string = tokio::fs::read_to_string(receipt)
|
||||
.await
|
||||
.wrap_err("Reading receipt")?;
|
||||
|
|
Loading…
Reference in a new issue