@@ -2209,8 +2209,9 @@ fn shebang_interpreter(source: &str) -> Option<&str> {
22092209 return Some ( executable) ;
22102210 }
22112211 while let Some ( word) = words. next ( ) {
2212+ let word = word. strip_prefix ( "--split-string=" ) . unwrap_or ( word) ;
22122213 match word {
2213- "-S" | "--split-string" | "-i" | "--ignore-environment" => continue ,
2214+ "" | " -S" | "--split-string" | "-i" | "--ignore-environment" => continue ,
22142215 "-u" | "--unset" | "-C" | "--chdir" => {
22152216 words. next ( ) ?;
22162217 }
@@ -4444,6 +4445,12 @@ mod tests {
44444445 ( "#!/bin/zsh -f" , Some ( "bash" ) ) ,
44454446 ( "#!/usr/bin/env fish" , Some ( "fish" ) ) ,
44464447 ( "#!/usr/bin/env -S bash -eu" , Some ( "bash" ) ) ,
4448+ ( "#!/usr/bin/env --split-string=bash -eu" , Some ( "bash" ) ) ,
4449+ ( "#!/usr/bin/env --split-string=/bin/fish" , Some ( "fish" ) ) ,
4450+ ( "#!/usr/bin/env --split-string=-i bash" , Some ( "bash" ) ) ,
4451+ ( "#!/usr/bin/env --split-string= bash" , Some ( "bash" ) ) ,
4452+ ( "#!/usr/bin/env --split-string=missing bash" , None ) ,
4453+ ( "#!/usr/bin/env --split-string=" , None ) ,
44474454 (
44484455 "#!/usr/bin/env --split-string pwsh -NoProfile" ,
44494456 Some ( "powershell" ) ,
0 commit comments