Skip to content

Commit

Permalink
Revert "fix(cli): deno upgrade file permission (denoland#18427)" (den…
Browse files Browse the repository at this point in the history
…oland#18467)

This reverts commit 0742ea1.

Closes denoland#18466
  • Loading branch information
bartlomieju committed Mar 31, 2023
1 parent 7ec4577 commit cbd1408
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cli/tools/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,13 @@ pub async fn upgrade(
) -> Result<(), AnyError> {
let ps = ProcState::build(flags).await?;
let current_exe_path = std::env::current_exe()?;
let output_exe_path =
upgrade_flags.output.as_ref().unwrap_or(&current_exe_path);
let metadata = fs::metadata(output_exe_path)?;
let metadata = fs::metadata(&current_exe_path)?;
let permissions = metadata.permissions();

if permissions.readonly() {
bail!(
"You do not have write permission to {}",
output_exe_path.display()
current_exe_path.display()
);
}
#[cfg(unix)]
Expand All @@ -284,7 +282,7 @@ pub async fn upgrade(
"You don't have write permission to {} because it's owned by root.\n",
"Consider updating deno through your package manager if its installed from it.\n",
"Otherwise run `deno upgrade` as root.",
), output_exe_path.display());
), current_exe_path.display());
}

let client = &ps.http_client;
Expand Down

0 comments on commit cbd1408

Please sign in to comment.