74th / xonsh-direnv

xonsh extension for using direnv
MIT License
26 stars 8 forks source link

Env variables not unloaded after moving outside directory with .envrc #5

Closed worldmind closed 4 years ago

worldmind commented 5 years ago

Hi, thanks for your project - it is that I need. But a couple of questions:

con-f-use commented 5 years ago

Yes, known problem. See here: https://github.com/74th/xonsh-direnv/issues/2

def __direnv():
    p = subprocess.Popen(
        'direnv export json'.split(),
        stdout=subprocess.PIPE,
        env=__xonsh__.env.detype()
    )
    r, _ = p.communicate()
    if len(r) > 0:
        for k, v in json.loads(r).items():
            if v is None:
                del (__xonsh__.env[k])
            else:
                __xonsh__.env[k] = v

Best fix for now...

con-f-use commented 4 years ago

https://github.com/74th/xonsh-direnv/pull/7 should close this issue.

worldmind commented 4 years ago

Now works fine, thanks! It's great!

con-f-use commented 4 years ago

@74th, if you give me rights to this repo I could help manage it and e.g. close this issue.