broot
broot copied to clipboard
MacOS 10.14 No application knows how to open - panic
Describe the bug broot crashes on MacOS/zsh if $EDITOR is undefined and <Enter> is used to open a file.
To Reproduce
- brew install broot
- allow it to setup .zshrc
- launch br
- filter .gradle files (no $EDITOR defined)
gradle h:n gi:athread
'<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Open Error : "command \'open\' did not execute successfully; exit code: 1\ncommand stderr:\nNo application knows how to open [...]build.gradle."
Expected behavior
broot either opens the build.gradle
file with $EDITOR, or if $EDITOR is undefined, asks the user to set it. broot doesn't crash/panic.
Configuration (please complete the following information):
- broot 0.10.3 installed with brew
- OS: MacOS
- Version 10.14
- zsh 5.3 (x86_64-apple-darwin18.0)
Additional information
Broot also messes up iTerm2 at the end, using the mouse wheel to scroll prints characters instead of scrolling. I have to reset
to get the terminal back to normal.
Digging around I found the config file (~/Library/Preferences/org.dystroy.broot/conf.toml
or in broot type ?
and scroll down using arrow keys and it lists the config file location)
Inside there I found it mentions $EDITOR:
# If $EDITOR isn't set on your computer, you should either set it
# or just replace it with your editor of choice in the 'execution'
# pattern.
# Example:
# execution = "/usr/bin/nvim {file}"
[[verbs]]
invocation = "edit"
key = "F2"
shortcut = "e"
execution = "$EDITOR {file}"
I also just installed Broot to try it out through Brew on MacOS 10.15.2, I edited the mentioned conf.toml
to replace both instances of $EDITOR
with vim
and pressing enter on a file to open it still lags for a little before opening up a xcode window asking me to install new tools for debugging.
(Fast edit)
To clarify, here is the window that appears when attempting to edit a file:
It is worth noting that I just tried to replace vim
with the absolute path to vim on my system and that also did not fix the issue.
Second note: I installed and tested Broot 0.11.4 and found the same problem to exist.
👋🏻 I installed from source and have version 1.7.3
.
If I try to press <Enter>
then I get an error about no application knows how to open this file, and some times it would slowly open the xcode prompt. This is although I have $EDITOR
already set to vim
.
I then tried the -> arrow and this had the same issue.
If I do :e
it works fine and opens in vim.
I then noticed in the file browser ui on macOS that the default app for most unknown files is XCode. I changed it (just out of interest) to the text.app program and now if I use -> or <Enter>
then text.app gets used? So it looks like broot isn't respecting the $EDITOR
environment variable unless using :e
and instead uses the file system's recognised editor.
So it looks like broot isn't respecting the $EDITOR environment variable unless using :e and instead uses the file system's recognised editor
Yes, this is by design. It can be changed in configuration. See https://dystroy.org/broot/tricks/#change-standard-file-opening
Thanks @Canop!
Thinking about this more it makes perfect sense that what you described would be the default.
If I press <Enter>
on an image, then I want whatever the default app for handling images to continue to do that and not open in vim.
So yeah having Enter behave differently to :e
makes sense to me now 👍🏻
Can we close the issue now ?
Expected behavior broot either opens the build.gradle file with $EDITOR, or if $EDITOR is undefined, asks the user to set it. broot doesn't crash/panic.
Well, I guess it depends if you agree with my expected behavior. If you don't, then yes, it can be closed.
Personally I don't think an application should just crash, even in case of misconfiguration (which is debatable, at this point you don't even know about the configuration files).
Oh, I missed the crash.
Sorry, too many open projects and not enough time... I clearly overlooked the issue. The crash must be solved, yes.
Can somebody who reproduces this crash do it with RUST_BACKTRACE=1
and give me the backtrace ?
I don't get a crash but a garbled error message with
br --version
broot 1.36.1
You'll get a clearer error message by widening your terminal or by looking in the log.
Thanks
The error message is still too long if it is full screen. (but enough to recognise it). - it was not having sweet in finder a handler for this.
For the log I have to restart and repeat the same actions?
For the log I have to restart and repeat the same actions?
Yes