Closed RobBednark closed 2 years ago
Hey @RobBednark, sorry to hear that. What shell are you using and how did you install mcfly? It sounds like it's not being sourced correctly on shell startup.
What shell are you using...?
I'm on MacOS using:
$ bash --version
GNU bash, version 5.1.4(1)-release (x86_64-apple-darwin19.6.0)
how did you install mcfly?
I installed it via brew install mcfly
$ mcfly --version
McFly 0.5.10
Thanks @RobBednark. Sorry for the delay.
1) What does echo $MCFLY_SESSION_ID
output in your shell?
2) If you type some other shell command first, then run mcfly, does it work? I'm wondering if I have a bug where mcfly doesn't work until a command has been added to the history in your current session.
Having the same issue on bash:
$ eval $(mcfly init bash)
$ mcfly search x
thread 'main' panicked at 'McFly error: Please ensure that MCFLY_SESSION_ID contains a random session ID (environment variable not found)', src/settings.rs:285:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ MCFLY_HISTORY=1 MCFLY_SESSION_ID=2 mcfly search x # works
mcfly version: 0.6.0
I assume MCFLY_SESSION_ID
isn't set for you?
I assume
MCFLY_SESSION_ID
isn't set for you?
Yes, it isn't set after I initialize mcfly
with eval
. However, if I do the following (on Arch Linux) it works:
$ source /usr/share/doc/mcfly/mcfly.bash
$ echo $MCFLY_SESSION_ID
OlKBqbEd98BAn2yfwQLhYd6R
Putting the eval statement in .bashrc
also doesn't work for me. Weird.
same thing happening for me
All I can think of is that either [[ -t 0 ]] || return
is returning in eval but not in source, or maybe somehow __MCFLY_LOADED
is getting set. If you want to help debug, you could add some echo statements in /usr/share/doc/mcfly/mcfly.bash
to help see how far it's getting into the file.
Having the same issue on bash:
$ eval $(mcfly init bash) $ mcfly search x thread 'main' panicked at 'McFly error: Please ensure that MCFLY_SESSION_ID contains a random session ID (environment variable not found)', src/settings.rs:285:29 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace $ MCFLY_HISTORY=1 MCFLY_SESSION_ID=2 mcfly search x # works
Okay I figured it out, I was missing double quotes 😮💨 This works:
$ eval "$(mcfly init bash)"
or
$ echo 'eval "$(mcfly init bash)"' >> ~/.bashrc
Oh I'm glad you figured it out!
tldr: it appears I need to set
MCFLY_HISTORY=1
otherwise I get a panick. There's no mention ofMCFLY_HISTORY
in the docs, so I think it needs to be added.Details: I just installed mcfly for the first time (
brew tap cantino/mcfly ; brew install mcfly
) I usebash
and I addedeval "$(mcfly init bash)"
to the end of my.bashrc
When I tried running it I got:However, this worked:
$ MCFLY_HISTORY=1 mcfly search foo