From 006f61f0a00c25e1d19d86f339841f7de6d26cb4 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 21:39:48 -0700 Subject: [PATCH 01/15] Setup Github Actions --- .github/workflows/rust.yml | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..e7845be --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,65 @@ +name: Rust + +on: + push: + branches: [ "main" ] + + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt, clippy + + - name: Cache Dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-rust- + + - name: Format + uses: actions-rust-lang/rustfmt@v1 + + - name: Lint + run: cargo clippy --workspace --all-targets --all-features -- -D warnings + env: + RUSTFLAGS: "-D warnings" + + - name: Install Tools + uses: taiki-e/install-action@v2 + with: + tool: cargo-bininstall, cargo-llvm-cov, nextest + + - name: Test + run: | + cargo llvm-cov --no-report nextest + cargo llvm-cov --no-report --doc + cargo llvm-cov report --doctests --lcov --output-path lcov.info + + - name: Upload Coverage + uses: codecov/codecov-action@v3 + with: + files: lcov.info From 384258421976493bfa6c90e4aeffbf49e772fd1f Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 21:40:45 -0700 Subject: [PATCH 02/15] Update source. --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + src/unix/exit_code.rs | 6 +++++- src/unix/signal.rs | 6 +++++- src/unix/wait_status.rs | 6 +++++- src/windows.rs | 8 ++++++-- 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a77e5e..fe034aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,6 +52,7 @@ dependencies = [ "num-traits", "serde", "serde_json", + "serde_test", ] [[package]] @@ -101,6 +102,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_test" +version = "1.0.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f901ee573cab6b3060453d2d5f0bae4e6d628c23c0a962ff9b5f1d7c8d4f1ed" +dependencies = [ + "serde", +] + [[package]] name = "syn" version = "2.0.101" diff --git a/Cargo.toml b/Cargo.toml index 06e24c8..860df55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,3 +31,4 @@ default-features = false [dev-dependencies] libc = "0.2.172" serde_json = "1.0.140" +serde_test = "1.0.177" diff --git a/src/unix/exit_code.rs b/src/unix/exit_code.rs index e02c956..f967706 100644 --- a/src/unix/exit_code.rs +++ b/src/unix/exit_code.rs @@ -4,7 +4,11 @@ use crate::raw::RawExitCode; /// A Unix-like exit code. #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr( + feature = "serde", + derive(serde::Serialize, serde::Deserialize), + serde(transparent) +)] pub struct ExitCode(u8); impl ExitCode { diff --git a/src/unix/signal.rs b/src/unix/signal.rs index 1142b0e..0cddd96 100644 --- a/src/unix/signal.rs +++ b/src/unix/signal.rs @@ -4,7 +4,11 @@ use core::fmt::Display; /// /// Represents a signal that can be sent to or received by processes on Unix-like systems. #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr( + feature = "serde", + derive(serde::Serialize, serde::Deserialize), + serde(transparent) +)] pub struct Signal(u8); impl Signal { diff --git a/src/unix/wait_status.rs b/src/unix/wait_status.rs index ce02ded..35d53e5 100644 --- a/src/unix/wait_status.rs +++ b/src/unix/wait_status.rs @@ -8,7 +8,11 @@ use super::{ExitCode, Signal, WaitState}; /// this struct encapsulates that information and can separate the exit code from the signal that /// caused the termination, or whether the process was stopped or continued. #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr( + feature = "serde", + derive(serde::Serialize, serde::Deserialize), + serde(transparent) +)] pub struct WaitStatus(i32); impl WaitStatus { diff --git a/src/windows.rs b/src/windows.rs index 5fe4024..8ce8ebb 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -8,7 +8,11 @@ use core::fmt::Display; /// A Windows-specific exit code. #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr( + feature = "serde", + derive(serde::Serialize, serde::Deserialize), + serde(transparent) +)] pub struct ExitCode(u32); impl ExitCode { @@ -162,7 +166,7 @@ mod tests { } } -#[cfg(all(test, feature = "serde"))] +#[cfg(all(test, windows, feature = "serde"))] mod serde_tests { use super::*; use serde_json; From 27344e4daf0dddaf060d67f22d014093e435216b Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 21:41:49 -0700 Subject: [PATCH 03/15] Remove needless main. --- .github/workflows/rust.yml | 1 + README.md | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e7845be..7671101 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,6 +60,7 @@ jobs: cargo llvm-cov report --doctests --lcov --output-path lcov.info - name: Upload Coverage + if: matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: files: lcov.info diff --git a/README.md b/README.md index 436d37f..d201a13 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,11 @@ Unix exit code from a raw integer: ```rust use proc_result::unix::ExitCode; -fn main() { - let code = ExitCode::from_raw(1); - if code.is_success() { - println!("Command succeeded!"); - } else { - eprintln!("Command failed with exit code: {}", code); - } +let code = ExitCode::from_raw(1); +if code.is_success() { + println!("Command succeeded!"); +} else { + eprintln!("Command failed with exit code: {}", code); } ``` From 7c9556684b876c2b889623b4499206fd72d3278d Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 21:44:59 -0700 Subject: [PATCH 04/15] Add .vscode. --- .vscode/settings.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..73707f8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "rust-analyzer.check.extraArgs": [ + "--workspace --all-targets --all-features -- -D warnings" + ], + "rust-analyzer.check.command": "clippy" +} From f9771e73ed35b4dc71e264db897cac573b5daa4a Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 21:48:33 -0700 Subject: [PATCH 05/15] ++ --- .github/workflows/rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7671101..687b619 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,6 +14,7 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: - ubuntu-latest @@ -51,7 +52,7 @@ jobs: - name: Install Tools uses: taiki-e/install-action@v2 with: - tool: cargo-bininstall, cargo-llvm-cov, nextest + tool: cargo-llvm-cov, nextest - name: Test run: | From 7d9e6c3b3a1cbefe52caff06932612ef4fa875e7 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 21:51:40 -0700 Subject: [PATCH 06/15] ++ --- .github/workflows/rust.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 687b619..8d78cfa 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -55,10 +55,7 @@ jobs: tool: cargo-llvm-cov, nextest - name: Test - run: | - cargo llvm-cov --no-report nextest - cargo llvm-cov --no-report --doc - cargo llvm-cov report --doctests --lcov --output-path lcov.info + run: cargo llvm-cov nextest --no-fail-fast - name: Upload Coverage if: matrix.os == 'ubuntu-latest' From 9b2c6cdd43499ca81664e6bccbad9d7062a3d6dd Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:05:24 -0700 Subject: [PATCH 07/15] ++ --- .vscode/settings.json | 4 +- src/unix/wait_state.rs | 113 ++-------------------------------------- src/unix/wait_status.rs | 17 +----- 3 files changed, 10 insertions(+), 124 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 73707f8..07ef896 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "rust-analyzer.check.extraArgs": [ - "--workspace --all-targets --all-features -- -D warnings" + "--all-features", + "--", + "-D warnings" ], "rust-analyzer.check.command": "clippy" } diff --git a/src/unix/wait_state.rs b/src/unix/wait_state.rs index 6113358..fd17544 100644 --- a/src/unix/wait_state.rs +++ b/src/unix/wait_state.rs @@ -23,14 +23,8 @@ pub enum WaitState { core_dump: bool, }, - /// Indicates that the process was stopped (paused) by a signal. - Stopped { - /// The signal that caused the process to stop. - signal: Signal, - }, - - /// Indicates that the process was continued after being stopped. - Continued, + /// Indicates a wait status code that is not recognized or supported. + Unsupported(i32), } impl WaitState { @@ -46,14 +40,8 @@ impl WaitState { signal: Signal::from_raw(Self::w_term_sig(status)), core_dump: Self::is_w_coredump(status), } - } else if Self::is_w_stopped(status) { - Self::Stopped { - signal: Signal::from_raw(Self::w_stop_sig(status)), - } - } else if Self::is_w_continued(status) { - Self::Continued } else { - unreachable!() + Self::Unsupported(status) } } @@ -72,8 +60,7 @@ impl WaitState { Self::Signaled { signal, core_dump } => { (signal.to_raw() as i32) | if *core_dump { 0x80 } else { 0 } } - Self::Stopped { signal } => 0x7F | ((signal.to_raw() as i32) << 8), - Self::Continued => 0x7F, + Self::Unsupported(code) => *code, } } @@ -96,14 +83,6 @@ impl WaitState { status & 0xFF } - /// A copy of the Unix `WIFCONTINUED(status)` macro. - #[allow(non_snake_case)] - #[inline] - #[must_use] - const fn WIFCONTINUED(status: i32) -> bool { - Self::_WSTATUS(status) == Self::_WSTOPPED && Self::WSTOPSIG(status) == 0x13 - } - /// A copy of the Unix `WIFSIGNALED(status)` macro. #[allow(non_snake_case)] #[inline] @@ -112,14 +91,6 @@ impl WaitState { Self::_WSTATUS(status) != Self::_WSTOPPED && Self::_WSTATUS(status) != 0 } - /// A copy of the Unix `WIFSTOPPED(status)` macro. - #[allow(non_snake_case)] - #[inline] - #[must_use] - const fn WIFSTOPPED(status: i32) -> bool { - Self::_WSTATUS(status) == Self::_WSTOPPED && Self::WSTOPSIG(status) != 0x13 - } - /// A copy of the Unix `WTERMSIG(status)` macro. #[allow(non_snake_case)] #[inline] @@ -194,14 +165,6 @@ impl WaitState { Self::WTERMSIG(status) as u8 } - /// Returns `true` if the status indicates that the process was stopped by a signal. - /// - /// Equivalent to the Unix `WIFSTOPPED(status)` macro. - #[must_use] - pub const fn is_w_stopped(status: i32) -> bool { - Self::WIFSTOPPED(status) - } - /// Returns the signal number that caused the process to stop. /// /// Equivalent to the Unix `WSTOPSIG(status)` macro. @@ -215,14 +178,6 @@ impl WaitState { Self::WSTOPSIG(status) as u8 } - /// Returns `true` if the status indicates that the process was continued. - /// - /// Equivalent to the Unix `WIFCONTINUED(status)` macro. - #[must_use] - pub const fn is_w_continued(status: i32) -> bool { - Self::WIFCONTINUED(status) - } - /// Returns `true` if the status indicates a core dump occurred. /// /// Equivalent to the Unix `WCOREDUMP(status)` macro. @@ -326,47 +281,13 @@ mod tests { }; assert_eq!(status.to_raw(), 0x0000_0081); } - - #[test] - fn test_from_raw_stopped() { - let status = WaitState::from_raw(0x0000_007F); - assert_eq!( - status, - WaitState::Stopped { - signal: Signal::from_raw(0), - } - ); - } - - #[test] - fn test_to_raw_stopped() { - let status = WaitState::Stopped { - signal: Signal::from_raw(0), - }; - assert_eq!(status.to_raw(), 0x0000_007F); - } - - #[test] - fn test_from_raw_continued() { - let status = WaitState::from_raw(0x0000_137F); - assert_eq!(status, WaitState::Continued); - } - - #[test] - fn test_to_raw_continued() { - let status = WaitState::Continued; - assert_eq!(status.to_raw(), 0x7F); - } } // Tests that compare the behavior of the `UnixWaitIf` struct with the libc macros. #[cfg(test)] mod libc_verification_tests { use super::*; - use libc::{ - WCOREDUMP, WEXITSTATUS, WIFCONTINUED, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WSTOPSIG, - WTERMSIG, - }; + use libc::{WCOREDUMP, WEXITSTATUS, WIFEXITED, WIFSIGNALED, WSTOPSIG, WTERMSIG}; #[test] fn test_wifexited_true() { @@ -410,36 +331,12 @@ mod libc_verification_tests { assert_eq!(WaitState::w_term_sig(0x0000_0001), 1); } - #[test] - fn test_wifstopped_true() { - assert!(WIFSTOPPED(0x0000_007F)); - assert!(WaitState::is_w_stopped(0x0000_007F)); - } - - #[test] - fn test_wifstopped_false() { - assert!(!WIFSTOPPED(0x0000_0000)); - assert!(!WaitState::is_w_stopped(0x0000_0000)); - } - #[test] fn test_wstopsig() { assert_eq!(WaitState::w_stop_sig(0x0000_007F), 0); assert_eq!(WSTOPSIG(0x0000_007F), 0); } - #[test] - fn test_wifcontinued_true() { - assert!(WIFCONTINUED(0x0000_137F)); - assert!(WaitState::is_w_continued(0x0000_137F)); - } - - #[test] - fn test_wifcontinued_false() { - assert!(!WIFCONTINUED(0x0000_0000)); - assert!(!WaitState::is_w_continued(0x0000_0000)); - } - #[test] fn test_wcoredump_true() { assert!(WCOREDUMP(0x0000_0081)); diff --git a/src/unix/wait_status.rs b/src/unix/wait_status.rs index 35d53e5..ff8da1b 100644 --- a/src/unix/wait_status.rs +++ b/src/unix/wait_status.rs @@ -49,18 +49,6 @@ impl WaitStatus { matches!(self.state(), WaitState::Exited { .. }) } - /// Returns `true` if the process was stopped by a signal. - #[must_use] - pub const fn is_stopped(&self) -> bool { - matches!(self.state(), WaitState::Stopped { .. }) - } - - /// Returns `true` if the process was continued after being stopped. - #[must_use] - pub const fn is_continued(&self) -> bool { - matches!(self.state(), WaitState::Continued) - } - /// Returns `true` if the process was terminated by a signal. #[must_use] pub const fn is_signaled(&self) -> bool { @@ -80,9 +68,8 @@ impl WaitStatus { #[must_use] pub const fn signal(&self) -> Option { match self.state() { - WaitState::Stopped { signal, .. } | WaitState::Signaled { signal, .. } => Some(signal), - WaitState::Continued => Some(Signal::CONTINUE), - WaitState::Exited { exit_code: _ } => None, + WaitState::Signaled { signal, .. } => Some(signal), + _ => None, } } } From 0c0a6119f59a6e8162671b4f0975034cbc3d2292 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:12:24 -0700 Subject: [PATCH 08/15] Add docs. --- .github/workflows/docs.yml | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..47704ee --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,68 @@ +name: Docs + +on: + push: + branches: [ "main" ] + +concurrency: + group: deploy + cancel-in-progress: false + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Cache Dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-rust- + + - name: Setup pages + id: pages + uses: actions/configure-pages@v5 + + - name: Clean docs folder + run: cargo clean --doc + + - name: Build docs + run: cargo doc --no-deps + + - name: Add redirect + run: echo '' > target/doc/index.html + + - name: Remove lock file + run: rm target/doc/.lock + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: target/doc + + deploy: + runs-on: ubuntu-latest + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From d345658defeb8b50e10355fa7b5a8e59ef300303 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:16:29 -0700 Subject: [PATCH 09/15] Fix windows tests. --- src/unix/wait_state.rs | 2 +- src/windows.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/unix/wait_state.rs b/src/unix/wait_state.rs index fd17544..78a1734 100644 --- a/src/unix/wait_state.rs +++ b/src/unix/wait_state.rs @@ -284,7 +284,7 @@ mod tests { } // Tests that compare the behavior of the `UnixWaitIf` struct with the libc macros. -#[cfg(test)] +#[cfg(all(test, unix))] mod libc_verification_tests { use super::*; use libc::{WCOREDUMP, WEXITSTATUS, WIFEXITED, WIFSIGNALED, WSTOPSIG, WTERMSIG}; diff --git a/src/windows.rs b/src/windows.rs index 8ce8ebb..f0fcae3 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -118,7 +118,7 @@ impl From<&std::process::ExitStatus> for ExitCode { impl From<&ExitCode> for std::process::ExitStatus { fn from(code: &ExitCode) -> Self { use std::os::windows::process::ExitStatusExt; - std::process::ExitStatus::from_raw(code.to_raw()) + std::process::ExitStatus::from_raw(code.to_raw() as i32) } } @@ -150,6 +150,7 @@ mod tests { #[test] #[cfg(all(feature = "std", windows))] fn test_from_exit_status() { + use std::os::windows::process::ExitStatusExt; use std::process::ExitStatus; // Simulate a successful exit status @@ -170,7 +171,6 @@ mod tests { mod serde_tests { use super::*; use serde_json; - use std::os::windows::process::ExitStatusExt; #[test] fn test_serde() { From 983b1965d0dc38c7cd2be6b77a996d481c893434 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:18:37 -0700 Subject: [PATCH 10/15] ++ --- src/unix/wait_status.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/wait_status.rs b/src/unix/wait_status.rs index ff8da1b..d76ac60 100644 --- a/src/unix/wait_status.rs +++ b/src/unix/wait_status.rs @@ -1,5 +1,3 @@ -use std::os::unix::process::ExitStatusExt; - use super::{ExitCode, Signal, WaitState}; /// A Unix-like wait status. @@ -80,6 +78,7 @@ impl From<&std::process::ExitStatus> for WaitStatus { if let Some(code) = status.code() { WaitStatus::from_raw(code) } else { + use std::os::unix::process::ExitStatusExt; WaitStatus::from_raw(status.into_raw()) } } @@ -88,6 +87,7 @@ impl From<&std::process::ExitStatus> for WaitStatus { #[cfg(all(unix, feature = "std"))] impl From<&WaitStatus> for std::process::ExitStatus { fn from(status: &WaitStatus) -> Self { + use std::os::unix::process::ExitStatusExt; std::process::ExitStatus::from_raw(status.to_raw()) } } From 9dd40fc901449ee52115e3d769597c77a706fbdd Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:20:54 -0700 Subject: [PATCH 11/15] ++ --- src/windows.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/windows.rs b/src/windows.rs index f0fcae3..97501e8 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -118,7 +118,7 @@ impl From<&std::process::ExitStatus> for ExitCode { impl From<&ExitCode> for std::process::ExitStatus { fn from(code: &ExitCode) -> Self { use std::os::windows::process::ExitStatusExt; - std::process::ExitStatus::from_raw(code.to_raw() as i32) + std::process::ExitStatus::from_raw(code.to_raw()) } } @@ -155,13 +155,13 @@ mod tests { // Simulate a successful exit status let success_status = ExitStatus::from_raw(0); - let success_code: ExitCode = success_status.into(); + let success_code: ExitCode = (&success_status).into(); assert!(success_code.is_success()); assert_eq!(success_code.to_raw(), 0); // Simulate a failure exit status let failure_status = ExitStatus::from_raw(1); - let failure_code: ExitCode = failure_status.into(); + let failure_code: ExitCode = (&failure_status).into(); assert!(failure_code.is_failure()); assert_eq!(failure_code.to_raw(), 1); } From 50749bf4fa9914b1720833ad012dda4fa621437a Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:24:18 -0700 Subject: [PATCH 12/15] ++ --- src/windows.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/windows.rs b/src/windows.rs index 97501e8..1c7a6fe 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -110,7 +110,13 @@ impl Display for ExitCode { #[cfg(all(windows, feature = "std"))] impl From<&std::process::ExitStatus> for ExitCode { fn from(status: &std::process::ExitStatus) -> ExitCode { - ExitCode::from_raw(status.code().expect("cannot fail on Windows")) + ExitCode::from_raw( + status + .code() + .expect("cannot fail on Windows") + .try_into() + .unwrap(), + ) } } From e3bb83fe32e45dcf85b6c590412e61af7203732b Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:28:54 -0700 Subject: [PATCH 13/15] ++ --- .github/workflows/rust.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8d78cfa..ff6702e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -55,10 +55,11 @@ jobs: tool: cargo-llvm-cov, nextest - name: Test - run: cargo llvm-cov nextest --no-fail-fast + run: cargo llvm-cov nextest --no-fail-fast --lcov --output-path=coverage/lcov.info - name: Upload Coverage if: matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: - files: lcov.info + files: coverage/lcov.info + fail_ci_if_error: true From 8bddc17ca8062a9f6dd2be61a0d39741fc6e3ea3 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:30:21 -0700 Subject: [PATCH 14/15] ++ --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ff6702e..43a46e2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -55,11 +55,11 @@ jobs: tool: cargo-llvm-cov, nextest - name: Test - run: cargo llvm-cov nextest --no-fail-fast --lcov --output-path=coverage/lcov.info + run: cargo llvm-cov nextest --no-fail-fast --lcov --output-path lcov.info - name: Upload Coverage if: matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: - files: coverage/lcov.info + files: lcov.info fail_ci_if_error: true From 16d28a2f8f1c55d2f838edf886154ee39e9e2f1e Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Sat, 31 May 2025 22:36:03 -0700 Subject: [PATCH 15/15] ++ --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 43a46e2..db66f47 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -63,3 +63,4 @@ jobs: with: files: lcov.info fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }}