Skip to content

Commit

Permalink
bench/fasd: workaround fasd 'empty history' bug
Browse files Browse the repository at this point in the history
Fasd, in some some bash configuratoins, fails in its prompt function if
the history file is empty. This is due to
https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130
implicitly assuming 'history 1' returns something.

Note, this bug appears to occur on bash 4.3+ubuntu but not 4.4+fedora.
As such, it happens on travis-ci even though it doesn't impact my local
environment.

It seems possible that travis's bash is setting 'shift_verbose' leading
to this, but frankly now that it works I'm going to pretend none of this
happened.
  • Loading branch information
euank committed Dec 16, 2017
1 parent ffb7a20 commit 6ff9afc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/src/harness/autojumpers/fasd.rs
Expand Up @@ -19,8 +19,18 @@ impl Autojumper for Fasd {

fn init_for(&self, shell: &Shell) -> String {
match shell {
&Shell::Bash | &Shell::Zsh => {
format!(r#"eval "$({} --init posix-alias {}-hook)""#, self.bin_path(), shell.name())
&Shell::Bash => {
format!(r#"
# Ensure history is not blank; fasd grabs commands to process from history
# (https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130)
# and, if history is empty, will error out
echo "echo hello world" >> ~/.bash_history
eval "$({} --init posix-alias bash-hook)"
"#, self.bin_path())
}
&Shell::Zsh => {
format!(r#"eval "$({} --init posix-alias zsh-hook)""#, self.bin_path())
}
&Shell::Conch => unimplemented!(),
}
Expand Down

0 comments on commit 6ff9afc

Please sign in to comment.