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..8d0935b 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) = path.file_stem().and_then(|stem| stem.to_str()) { + if stem == "pwsh" || stem == "powershell" { + return true; + } } }