broot icon indicating copy to clipboard operation
broot copied to clipboard

MacOS 10.14 No application knows how to open - panic

Open costincaraivan opened this issue 5 years ago • 13 comments

Describe the bug broot crashes on MacOS/zsh if $EDITOR is undefined and <Enter> is used to open a file.

To Reproduce

  1. brew install broot
  2. allow it to setup .zshrc
  3. launch br
  4. 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.

costincaraivan avatar Jan 09 '20 13:01 costincaraivan

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}"

JAStanton avatar Jan 09 '20 18:01 JAStanton

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: image

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.

MJJBennett avatar Jan 09 '20 19:01 MJJBennett

👋🏻 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.

Integralist avatar Nov 26 '21 12:11 Integralist

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

Canop avatar Nov 26 '21 16:11 Canop

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 👍🏻

Integralist avatar Dec 01 '21 14:12 Integralist

Can we close the issue now ?

Canop avatar Dec 01 '21 14:12 Canop

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).

costincaraivan avatar Dec 01 '21 14:12 costincaraivan

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.

Canop avatar Dec 01 '21 14:12 Canop

Can somebody who reproduces this crash do it with RUST_BACKTRACE=1 and give me the backtrace ?

Canop avatar Dec 03 '21 19:12 Canop

I don't get a crash but a garbled error message with

br --version
broot 1.36.1

Screenshot 2024-03-27 at 14 07 05

bestlem avatar Mar 27 '24 14:03 bestlem

You'll get a clearer error message by widening your terminal or by looking in the log.

Canop avatar Mar 27 '24 14:03 Canop

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?

bestlem avatar Mar 27 '24 14:03 bestlem

For the log I have to restart and repeat the same actions?

Yes

Canop avatar Mar 27 '24 14:03 Canop