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

Remove subprocess usage, remove spurious direnv calls #12

Merged
merged 1 commit into from
Jun 19, 2022

Conversation

gforsyth
Copy link
Contributor

This removes the usage of subprocess directly in favor of using xonsh to make the initial direnv call.

It also removes the precommand hook, since the combination of chdir and postcommand should cover just about everything (especially changes to watched files).

Finally, the chdir event only fires when we change into a new direnv dir, and not every time we move down the directory tree, so we aren't constantly reloading the same envrc (which can get quite slow when using nix)

@Mic92
Copy link

Mic92 commented May 28, 2022

Another advantage is also that this variant can be cancled with ctrl-c. Before it would close the whole shell, now it kills direnv.

@Mic92
Copy link

Mic92 commented May 28, 2022

Works for me!

@74th
Copy link
Owner

74th commented May 28, 2022

Thanks for the pull request.
The suggestion to remove subprocess is a good one.

The change to chdir, won't .envrc in a subdirectory stop working if the subdirectory also has .envrc?

But now that I run xonsh-direnv, I see that on_postcommand works even with "cd subdir".

@gforsyth
Copy link
Contributor Author

gforsyth commented Jun 9, 2022

@74th -- yep, I think it should still work.

@74th
Copy link
Owner

74th commented Jun 19, 2022

This works fine! Thank you!

@74th 74th merged commit 354e348 into 74th:master Jun 19, 2022
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 this pull request may close these issues.

3 participants