Skip to content

Commit

Permalink
fix(dre): asking for update everywhere (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaMilosa committed Jun 26, 2024
1 parent 00865c3 commit 2faf0cb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "891d21c460f45215d3826177f5450ce89dc2a0e8774dc85b7f7a84613185094b",
"checksum": "a619b6c7f65f05372f7e5dddd4e9a299c95a31a112847e34a992b0dbd1806ec3",
"crates": {
"actix-codec 0.5.2": {
"name": "actix-codec",
Expand Down Expand Up @@ -11156,6 +11156,10 @@
"id": "anyhow 1.0.86",
"target": "anyhow"
},
{
"id": "atty 0.2.14",
"target": "atty"
},
{
"id": "candid 0.10.9",
"target": "candid"
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ assert_matches = "1.5.0"
async-recursion = "1.1.1"
async-timer = "0.7.4"
async-trait = "0.1.80"
atty = "0.2.14"
axum-otel-metrics = "0.8.1"
backoff = { version = "0.4.0", features = ["tokio"] }
backon = "0.4.4"
Expand Down
1 change: 1 addition & 0 deletions rs/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ actix-web = { workspace = true }
anyhow = { workspace = true }
async-recursion = { workspace = true }
async-trait = { workspace = true }
atty = { workspace = true }
candid = { workspace = true }
clap = { workspace = true }
clap-num = { workspace = true }
Expand Down
5 changes: 5 additions & 0 deletions rs/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ic_admin::IcAdminWrapper;
use atty::Stream;
use clap::{error::ErrorKind, CommandFactory, Parser};
use dialoguer::Confirm;
use dotenv::dotenv;
Expand Down Expand Up @@ -641,6 +642,10 @@ fn init_logger() {
}

fn check_latest_release(curr_version: &str) -> anyhow::Result<UpdateStatus> {
if atty::isnt(Stream::Stdin) || std::env::var("DRE_REFUSE_UPDATE").is_ok() {
return Ok(UpdateStatus::RefusedUpdate);
}

// ^ --> start of line
// v? --> optional 'v' char
// (\d+\.\d+\.\d+) --> string in format '1.22.33'
Expand Down

0 comments on commit 2faf0cb

Please sign in to comment.