Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval "$(frum init)" appears to be broken on macos #128

Open
xcodedave opened this issue Jan 16, 2023 · 3 comments
Open

eval "$(frum init)" appears to be broken on macos #128

xcodedave opened this issue Jan 16, 2023 · 3 comments

Comments

@xcodedave
Copy link

Hi, running eval "$(frum init)" on macOS Ventura 13.1 appears to produce incorrect output. Placing eval "$(frum init)" within my ~/.zshrc file caused errors when source ~/.zshrc was run.

Running frum init directly generates the following output on my machine:

export PATH="/var/folders/qf/f11f0zsx4h76qqm9jfqyv3r00000gp/T/frum_30276_1673881668898/bin":$PATH
export FRUM_MULTISHELL_PATH="/var/folders/qf/f11f0zsx4h76qqm9jfqyv3r00000gp/T/frum_30276_1673881668898"
export FRUM_DIR="/Users/mindsetuser/.frum"
export FRUM_LOGLEVEL="info"
export FRUM_RUBY_BUILD_MIRROR="https://cache.ruby-lang.org/pub/ruby"
autoload -U add-zsh-hook
_frum_autoload_hook () {
    frum --log-level quiet local
}

add-zsh-hook chpwd _frum_autoload_hook \
    && _frum_autoload_hook

Directly running the following command fails on my machine:

add-zsh-hook chpwd _frum_autoload_hook \
    && _frum_autoload_hook

I managed to get it working by removing the trailing \ && _frum_autoload_hook from the add-zsh-hook command.

Is this a bug?

@xcodedave
Copy link
Author

As a temporary workaround for my machine, this is working in my ~/.zshrc file:

FRUM_INIT_OUTPUT="$(frum init)"
FIXED_FRUM_INIT_OUTPUT=${FRUM_INIT_OUTPUT%%"\\
    && _frum_autoload_hook"}
eval "$FIXED_FRUM_INIT_OUTPUT"

@TaKO8Ki
Copy link
Owner

TaKO8Ki commented Jan 17, 2023

I’ll check it later.

@fernandoacorreia
Copy link

fernandoacorreia commented Sep 21, 2023

The problem is that frum init is generating this line in _frum_autoload_hook:

frum --log-level quiet local

It looks like the root cause is that the local subcommand is failing. Running it on the terminal fails with:

error: Can't find version in dotfiles. Please provide a version manually to the command.

The --log-level quiet option suppresses this error output but the command still fails with exit code 1.

A good fix would be a new option so that local wouldn't fail with exit code 1 when there isn't a dotfile with the version, e.g. something like frum --log-level quiet --ignore-if-not-found local.

Meanwhile this is a workaround:

eval "$(frum init | sed "s/quiet local/quiet local | true/")"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants