From ef9723ba2e58c986c912cc0569f0afabd1581476 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Mon, 18 Nov 2024 15:50:47 +0100 Subject: [PATCH] Use bash always --- .github/workflows/rust-ci.yml | 1 + src/lib.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 27075a7..dfd7a2d 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -45,6 +45,7 @@ jobs: - name: cargo test build run: cargo build --tests --release - name: cargo test + shell: bash run: cargo test --release - name: detects powershell if: ${{ matrix.os != 'macos-14' }} diff --git a/src/lib.rs b/src/lib.rs index a33f640..be8cae0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -362,11 +362,11 @@ pub fn is_powershell_parent() -> bool { (ustr.length >> 1) as usize, )); - let path = os.to_string_lossy(); - eprintln!("{path}"); - let p = std::path::Path::new(path.as_ref()); - if p.file_stem() == Some(std::ffi::OsStr::new("pwsh")) { - return true; + let path = std::path::Path::new(&os); + if let Some(stem) = p.file_stem().and_then(|stem| stem.to_str()) { + if stem == "pwsh" || stem == "powershell" { + return true; + } } }