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
Passing info about currently executing shiv to child subprocesses #40
Comments
Not sure about non-hacky, but I can make your example use case by simply swapping |
Yea, relying on We currently use symlinks to make a certain path point to the latest shiv to use, but it would be nice to be able to move the shiv around (or have shivs in different locations) without having to update What I'd like is something like this: https://github.com/linkedin/shiv/compare/master...kennydo:kedo-set-env-var?expand=1. So |
@kennydo what about using the shiv as both your script's shebang?
|
That approach works, but still requires the child to know the name of the shiv. I think it'd be great if the child file didn't have to know that. In the meantime, I'm making do with having the parent look at |
As a suggestion for a more formal fix, how about this? We add an extra argument to This works in my use case (creating a zipapp for If this seems like a reasonable approach, I can create a PR for it. |
@pfmoore sounds great! can we call it |
Sounds good. I'll pull something together tonight. |
@sixninetynine What's the policy on tests? The best way to test the new code would probably be to refactor |
@pfmoore yeah, I intend to refactor bootstrap out a bit (for the reason you cite as well as to inch closer to closing #36) so for now a straight integ test or augmenting this integration test should be enough :) |
I have a particular python script that uses
subprocess
to create child processes that execute another script. What is the recommended way of passing down the info about the shiv's site directory down to the child?As an example, suppose I made a shiv like this:
I then make a
parent.py
that creates a child process:And then I make a
child.py
that makes use ofrequests
, like so:When I run it, I get output that looks like this:
Is there a non-hacky way for parent to know that it's running via a shiv, and that it needs to pass down info about the shiv to the child? Could we set some sort of environment variable in https://github.com/linkedin/shiv/blob/master/src/shiv/bootstrap/__init__.py#L86 that
parent.py
could check and use?The text was updated successfully, but these errors were encountered: