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

Read interactive shell ENV on *nix systems #1795

Open
kaste opened this issue May 17, 2021 · 2 comments
Open

Read interactive shell ENV on *nix systems #1795

kaste opened this issue May 17, 2021 · 2 comments

Comments

@kaste
Copy link
Contributor

kaste commented May 17, 2021

A recurring problem for *nix users is that the process environment Sublime runs in does not have everything set up as users think. Typically, for example nvm users see a different ENV per working dir.

Try to solve this and read a interactive bash shell to read the env in. Don't modify the global python env like #1509 did, instead read it keyed per working_dir and probably use the existing get_environment() to "distribute".

Related art: https://github.com/codexns/shellenv https://github.com/golang/sublime-config

For this to be of any use, refactor our which infrastructure to just use self.which with the enhanced PATH. Finally remove the global paths setting which is conceptually wrong anyway.

@tribals
Copy link

tribals commented Apr 27, 2023

Possible solution would be to add dependency on a shellenv "Package Control dependency":

Usage

To have a package require shellenv, add a file named dependencies.json into
the root folder of your Sublime Text package, and add the following:

{
    "*": {
        "*": [
            "shellenv"
        ]
    }
}

This indicates that for all operating systems (*), and all versions of
Sublime Text (nested *), require the shellenv dependency. You can also read
the
official documentation about dependencies.

Examples

The output of get_env() may be useful when launching a subprocess:

import subprocess
import shellenv

_, env = shellenv.get_env(for_subprocess=True)
proc = subprocess.Popen(['executable', '-arg'], env=env)

Reference: https://github.com/codexns/shellenv#usage

@tribals
Copy link

tribals commented Apr 27, 2023

See #1900.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants