From ef1f78fed76f883986734b7e3220b2f56508a5f0 Mon Sep 17 00:00:00 2001 From: Adam Perkowski <adas1per@protonmail.com> Date: Wed, 4 Dec 2024 16:47:42 +0100 Subject: [PATCH 1/2] fix: incorrect `--compare` colors --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d09a869..0625719 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,7 +57,7 @@ async fn compare(core: Core) -> error::Result<()> { "*".white().on_black(), new_pkg.0.blue(), old_pkg.1.version.red(), - new_pkg.1.version.blue() + new_pkg.1.version.green() ); } } else { From a8a42fdf03bfde7aeee563fbd6f9d7af832bc70e Mon Sep 17 00:00:00 2001 From: Adam Perkowski <adas1per@protonmail.com> Date: Wed, 4 Dec 2024 22:41:05 +0100 Subject: [PATCH 2/2] fix(io): not shutting down file streams after writing Resolves #7 --- .github/workflows/rust.yml | 5 +---- src/config.rs | 2 ++ src/verfiles.rs | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6b82f09..1679c2e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,7 +57,4 @@ jobs: - name: Test run: | - cargo test --lib - cargo test --lib --release - cargo test --doc - cargo test --doc --release + cargo test --all-features --no-fail-fast diff --git a/src/config.rs b/src/config.rs index ab10a0a..3e80c21 100644 --- a/src/config.rs +++ b/src/config.rs @@ -187,6 +187,8 @@ pub async fn save(config_content: Config, path: PathBuf) -> error::Result<()> { let mut file = fs::File::create(path).await?; let content = format!("{}\n", toml::to_string(&config_content)?); file.write_all(content.as_bytes()).await?; + file.shutdown().await?; + Ok(()) } diff --git a/src/verfiles.rs b/src/verfiles.rs index 7874b2d..329f8e0 100644 --- a/src/verfiles.rs +++ b/src/verfiles.rs @@ -76,6 +76,8 @@ pub async fn save( let content = format!("{}\n", serde_json::to_string_pretty(&verfile)?); file.write_all(content.as_bytes()).await?; + file.shutdown().await?; + Ok(()) } @@ -83,6 +85,7 @@ async fn load_file(path: &Path) -> error::Result<Verfile> { if !path.exists() { let mut file = fs::File::create(path).await?; file.write_all(TEMPLATE.as_bytes()).await?; + file.shutdown().await?; } let content = fs::read_to_string(path).await?;