Skip to content

Commit

Permalink
Add docs for #180 (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek authored Sep 16, 2022
1 parent ffb4fca commit 3fb4fbc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nox/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ def run(
# Display coverage report even when tests fail.
session.run("coverage", "report")
If you pass ``silent=True``, you can capture the output of a command that would
otherwise be shown to the user. For example to get the current Git commit ID::
out = session.run(
"git", "rev-parse", "--short", "HEAD",
external=True, silent=True
)
print("Current Git commit is", out.strip())
:param env: A dictionary of environment variables to expose to the
command. By default, all environment variables are passed.
:type env: dict or None
Expand All @@ -330,6 +340,12 @@ def run(
them. Set to ``None`` to never send a kill signal.
Default: ``0.2``
:type terminate_timeout: float or None
:param stdout: Redirect standard output of the command into a file. Can't be
combined with *silent*.
:type stdout: file or file descriptor
:param stderr: Redirect standard output of the command into a file. Can't be
combined with *silent*.
:type stderr: file or file descriptor
"""
if not args:
raise ValueError("At least one argument required to run().")
Expand Down

0 comments on commit 3fb4fbc

Please sign in to comment.