Do not check for self upgrade if already upgraded

This commit is contained in:
Roey Darwish Dror
2018-12-23 13:23:42 +02:00
parent ee54107d2a
commit 8e3727c73f
2 changed files with 2 additions and 1 deletions

View File

@@ -73,7 +73,7 @@ fn run() -> Result<(), Error> {
#[cfg(feature = "self-update")] #[cfg(feature = "self-update")]
{ {
if !opt.dry_run { if !opt.dry_run && !env::var("TOPGRADE_NO_SELF_UPGRADE").is_ok() {
if let Err(e) = self_update::self_update() { if let Err(e) = self_update::self_update() {
print_warning(format!("Self update error: {}", e)); print_warning(format!("Self update error: {}", e));
if let Some(cause) = e.cause() { if let Some(cause) = e.cause() {

View File

@@ -44,6 +44,7 @@ pub fn self_update() -> Result<(), Error> {
print_warning("Respawning..."); print_warning("Respawning...");
let err = Command::new(current_exe.context(ErrorKind::SelfUpdate)?) let err = Command::new(current_exe.context(ErrorKind::SelfUpdate)?)
.args(env::args().skip(1)) .args(env::args().skip(1))
.env("TOPGRADE_NO_SELF_UPGRADE", "")
.exec(); .exec();
Err(err).context(ErrorKind::SelfUpdate)? Err(err).context(ErrorKind::SelfUpdate)?
} }