mirror of
https://github.com/starship/starship.git
synced 2024-11-23 00:33:16 +01:00
fix: use procsub in bash since termux has no stdin (#241)
This commit is contained in:
parent
f61e7e2f87
commit
fa2d1c05a6
16
src/init.rs
16
src/init.rs
@ -35,10 +35,18 @@ pub fn init_stub(shell_name: &str) -> io::Result<()> {
|
||||
/* This *should* look like the zsh function, but bash 3.2 (MacOS default shell)
|
||||
does not support using source with process substitution, so we use this
|
||||
workaround from https://stackoverflow.com/a/32596626 */
|
||||
let script = format!(
|
||||
"source /dev/stdin <<<\"$(\"{}\" init bash --print-full-init)\"",
|
||||
starship
|
||||
);
|
||||
let script = {
|
||||
format!(
|
||||
r#"if [ "${{BASH_VERSINFO[0]}}" -gt 4 ]
|
||||
then
|
||||
source <("{}" init bash --print-full-init)
|
||||
else
|
||||
source /dev/stdin <<<"$("{}" init bash --print-full-init)"
|
||||
fi"#,
|
||||
starship, starship
|
||||
)
|
||||
};
|
||||
|
||||
Some(script)
|
||||
}
|
||||
Some("zsh") => {
|
||||
|
Loading…
Reference in New Issue
Block a user