Skip to content

Commit

Permalink
fix: Attempt to fix proto killed after upgrade. (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored May 26, 2023
1 parent ebede9e commit 4724b9f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

#### 🐞 Fixes

- Fixed an issue with Windows shims not being ran correctly.
- An attempt to fix "proto killed" errors after running `proto upgrade`.

## 0.9.1

#### 🚀 Updates
Expand Down
14 changes: 13 additions & 1 deletion crates/cli/src/commands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,20 @@ pub async fn upgrade() -> SystemResult {
unpack(temp_file, &temp_dir, None)?;

// Move the new binary to the bins directory
let bin_dir = get_bin_dir()?;
let bin_name = if cfg!(windows) { "proto.exe" } else { "proto" };
let bin_path = get_bin_dir()?.join(bin_name);
let bin_path = bin_dir.join(bin_name);

if bin_path.exists() {
fs::rename(
&bin_path,
bin_dir.join(if cfg!(windows) {
"proto-old.exe"
} else {
"proto-old"
}),
)?;
}

fs::copy_file(temp_dir.join(target_file).join(bin_name), &bin_path)?;
fs::update_perms(&bin_path, None)?;
Expand Down

0 comments on commit 4724b9f

Please sign in to comment.