Skip to content

Commit

Permalink
fix: Default to sh for non-POSIX shells
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinblackman committed Jul 5, 2024
1 parent 33a2c0f commit 08f85cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/shims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ use crate::metadata;
fn create_shim(binary: &str, bin_path: path::PathBuf) -> Result<()> {
use std::os::unix::prelude::OpenOptionsExt;

let shell = env::var("SHELL")
let mut shell = env::var("SHELL")
.unwrap_or("bash".to_string())
.split('/')
.last()
.unwrap()
.to_string();

if !vec!["bash", "zsh", "sh"].contains(&&*shell) {
shell = "sh".to_string();
}

let script = format!(
r#"#!/usr/bin/env {shell}
Expand Down

0 comments on commit 08f85cc

Please sign in to comment.