-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
Ability to pass shell=True
in session.run
so that the env
argument is actually taken into account.
#399
Comments
Oh I realize that this |
Expecting shell syntax to work is an easy mistake to make, especially when coming to Nox from Makefiles. So thanks for pointing that out! Unfortunately, passing commands through the shell opens a can of worms, with shell metacharacters, portability issues, and another process to take care of. It would also break existing Noxfiles that are written for the current behavior. So I think that it would be better not to enable this behavior by default. Using a list with Personally, I'm not convinced that supporting an explicit option for Do you think that the documentation should be clearer in this respect? |
Yeah, I'm -1 on adding |
Does a direct I did not mention it in my original post, but I did this because I was suspecting that my So my point is: even if it is not useful for nominal use, it might be the intuitive action a developper would try in a debugging experiment. Maybe this can be solved through a specific documentation section about environment variables vs. shell expansion, I dont know. |
No, we don't modify the environment of Nox itself. But you could set Edit: Or rather, pass the bin paths to shutil.which, that'll also work correctly on Windows.
If it's for advanced usage in a debugging session, invoking the shell explicitly via
The documentation of session.run has examples for both |
Indeed this documentation seems sufficient for me. You can close the ticket if no other idea/feedback pops up |
Alright, I'm closing this for now. Thanks for filing the issue @smarie :) |
Currently it seems that environment variables are not expanded by the underlying
popen
when you callsession.run
:displays
%PATH%
instead of the contents of this environment variableThe reason seems to be that the underlying
nox.popen.popen
does not useshell=True
(as also recommended in #379 (comment))This is maybe a windows-only issue ?
Anyway, I see two main ways to tackle this, all easy:
popen
receive arbitrary**kwargs
so that we can passshell=True
(and in this case, some documentation section should probably be added in the place where we talk aboutenv
)shell
be a first-class parameter insession.run
, with default valueshell=True
(disruptive) or False (conservative)What do you think ?
The text was updated successfully, but these errors were encountered: