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

'notes o' says it can't get a file descriptor on Linux #57

Open
rmNULL opened this issue Apr 2, 2018 · 5 comments
Open

'notes o' says it can't get a file descriptor on Linux #57

rmNULL opened this issue Apr 2, 2018 · 5 comments

Comments

@rmNULL
Copy link
Contributor

rmNULL commented Apr 2, 2018

Issue Summary

notes o doesn't open a directory as expected to.

Steps to Reproduce

  1. notes o

Couldn't get a file descriptor referring to the console

notes open

Apparently, open command gives the same error message, on the device I tried.
In another device, $ notes o reports "open: command not found"

Technical details:

  • notes version: master

P.S:
If output of any relevant commands will help, let me know. I'll be glad to paste it here.

@primis
Copy link
Collaborator

primis commented Apr 2, 2018

Could you output the result of the EDITOR variable? echo $EDITOR should do the trick. I have a feeling that this is due to you having editor set to a GUI editor or some weird default on the raspi.
Also, is your notes configuration the default one? if not please include that in your reply

@rmNULL
Copy link
Contributor Author

rmNULL commented Apr 2, 2018

$EDITOR is set to nvim
btw notes n works fine , so the case when notes o is passed a filename.
e.g: notes o ca.sh open a file.
but notes o gives the error message shown above.

  1. Yes I use the default configuration.

Relevant? https://unix.stackexchange.com/questions/253376/open-command-to-open-a-file-in-an-application

@pimterry
Copy link
Owner

pimterry commented Apr 3, 2018

Huh, interesting. That stackexchange answer is very useful. As far as I can tell this has never worked in linux, as it expects open to be the OSX command (which opens the file with the default handler), but open on most (all?) Linux OSs is a totally different thing.

We need to somehow fix that. A few options:

  • Build a list of options (xdg-open, open), call the first one that exists
    • Works well for this basic case
    • I'm not sure xdg-open is guaranteed to exist though, so there'll still be some cases where this doesn't work
  • Check the OS we're running in, and call the expected command
    • Open for OSX
    • xdg-open for Linux
    • ??? for Windows
    • Results in nice clear error messages if you don't have an easily supported system, and we can easily add extra fallback options later.
  • Just remove this functionality entirely
    • It is sometimes useful, but also a little odd that we integrate with the local GUI file manager in this otherwise very CLI-focused tool
  • Add a new config variable for the name of the file browser you want
    • Feels like overkill

I think I'm leaning towards the 2nd option. Thoughts?

@rmNULL
Copy link
Contributor Author

rmNULL commented Apr 3, 2018

I would prefer the 2nd option, we would also need to consider for BSD devices. I'll make a draft pull request. Throw in your suggestions.

edit:
Windows - start.exe

@rmNULL rmNULL mentioned this issue Apr 4, 2018
5 tasks
@pimterry pimterry changed the title I'm tired, I can't get a file descriptor referring to console 'notes o' says it can't get a file descriptor on Linux Apr 9, 2018
@Escyll
Copy link
Contributor

Escyll commented Jan 6, 2021

I might be late to the party here. There is a charm to the 4th option as well. On command-line I like to use the ranger file manager, but for UI related stuff I use dolphin as my file manager.
However, I think that option 2 and 4 are orthogonal to each other: Having an option to overrule a, in 90% of the cases, good default (like xdg-open, open and start.exe).

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

Successfully merging a pull request may close this issue.

4 participants