edc / bass

Make Bash utilities usable in Fish shell
MIT License
2.22k stars 71 forks source link

Don't copy exported bash functions #49

Closed daveyarwood closed 7 years ago

daveyarwood commented 7 years ago

I noticed that if you use bass to run a bash script like the following:

function foo() {
  local bar="baz"
  echo $bar
}

export -f foo

The bash function gets loaded into new_env with a key like BASH_FUNC_foo%% and the value is a string of Bash source code like () { local bar="baz"; echo $bar }.

So bass puts a line like the following into the Fish script:

set -g -x BASH_FUNC_foo%% "() { local bar="baz"; echo $bar }"

This fails when the script is executed for two reasons:

I don't think it makes any sense to copy exported Bash functions, so this PR makes it so that we skip them.

edc commented 7 years ago

Thanks for the fix!