dandavison / open-in-editor

Open a local file from a URL at a line number in an editor/IDE
55 stars 8 forks source link

[README.md] Mention that `EDITOR` may be set locally (on Linux ?) #4

Closed Kr1ss-XD closed 1 year ago

Kr1ss-XD commented 4 years ago

I noticed README.md states in the "Installation" paragraph :

Ensure that one of the environment variables OPEN_IN_EDITOR or EDITOR contains a path to an executable that open-in-editor is going to recognize. This environment variable must be set system-wide, not just in your shell process.

At least regarding Linux, this is not correct.

$ echo $FOO  # (unset)

$ python -c 'import os; print(os.getenv("FOO"))'
None
$ FOO=bar python -c 'import os; print(os.getenv("FOO"))'
bar

The results are the same with Python 3.8.5 and 2.7.18 btw.

EDIT: Interestingly, I do yield the same results using Python 3.8.2 as well as 2.7.16 in a (Catalina) Mac VM. Maybe the behavior described in the README was specific to some older version(s) of the Python libraries and has since been changed ?

dandavison commented 1 year ago

This environment variable must be set system-wide, not just in your shell process.

The docs say this because the Python script is launched by an OS mechanism and ends up not being a child process of the user shell process.