Skip to content

Commit

Permalink
Improve error message on failed updates (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jan 21, 2024
1 parent b47390b commit afdfc72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ that were not yet released.

_Unreleased_

- Improved the error message when an update could not be performed because files
are in use. #550

<!-- released start -->

## 0.19.0
Expand Down
8 changes: 6 additions & 2 deletions rye/src/cli/rye.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn update(args: UpdateCommand) -> Result<(), Error> {
.join("bin")
.join("rye")
.with_extension(EXE_EXTENSION),
)?;
)
} else {
let version = args.version.as_deref().unwrap_or("latest");
echo!("Updating to {version}");
Expand Down Expand Up @@ -216,8 +216,12 @@ fn update(args: UpdateCommand) -> Result<(), Error> {
{
fs::write(tmp.path(), bytes)?;
}
update_exe_and_shims(tmp.path())?;
update_exe_and_shims(tmp.path())
}
.context(
"Unable to perform update. This can happen because files are in use. \
Please stop running Python interpreters and retry the update.",
)?;

echo!("Updated!");
echo!();
Expand Down

0 comments on commit afdfc72

Please sign in to comment.