How would this feature be useful?
When calling programs that print machine-readable output on stdout (for example as JSON) and warnings on stderr (for example as text messages), having the combined output is not helpful since you now have valid JSON mixed with lines that make it invalid. Being able to obtain these outputs separately (for example as with subprocess.run) would make this a lot easier then trying to separate the combined output into parsable JSON and unrelated text.
Describe the solution you'd like
This could be an additional parameter to session.run(), like capture: bool = False. Though that function already has quite a few arguments.
capture could work by returning None if the command isn't run, or a tuple (stdout, stderr) (or (stdout, stderr, rc), while we're at it - see "Anything else?" below).
Describe alternatives you've considered
Directly using subprocess.run(). Getting that to use the session's venv though and global config parameters like no_install is non-trivial, and I'm not sure whether it's fully possible at all without accessing private nox internals.
Anything else?
Having access to the exact return code (and the possibility to disable nox's return code check) could also be helpful in some cases.
How would this feature be useful?
When calling programs that print machine-readable output on stdout (for example as JSON) and warnings on stderr (for example as text messages), having the combined output is not helpful since you now have valid JSON mixed with lines that make it invalid. Being able to obtain these outputs separately (for example as with
subprocess.run) would make this a lot easier then trying to separate the combined output into parsable JSON and unrelated text.Describe the solution you'd like
This could be an additional parameter to
session.run(), likecapture: bool = False. Though that function already has quite a few arguments.capturecould work by returningNoneif the command isn't run, or a tuple(stdout, stderr)(or(stdout, stderr, rc), while we're at it - see "Anything else?" below).Describe alternatives you've considered
Directly using
subprocess.run(). Getting that to use the session's venv though and global config parameters likeno_installis non-trivial, and I'm not sure whether it's fully possible at all without accessing private nox internals.Anything else?
Having access to the exact return code (and the possibility to disable nox's return code check) could also be helpful in some cases.