Skip to content

Commit

Permalink
subprocess_util: order arguments more logically
Browse files Browse the repository at this point in the history
  • Loading branch information
gotmax23 committed Mar 25, 2023
1 parent 0e3a9e1 commit c0cb66a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/antsibull_core/subprocess_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def _stream_log(
async def async_log_run(
args: Sequence[StrOrBytesPath],
logger: TwiggyLogger | StdLogger | None = None,
check: bool = True,
stdout_loglevel: str | None = None,
stderr_loglevel: str | None = 'debug',
check: bool = True,
**kwargs,
) -> subprocess.CompletedProcess:
"""
Expand All @@ -59,10 +59,11 @@ async def async_log_run(
:param logger:
Logger in which to log the command. Can be a `twiggy.logger.Logger` or
a stdlib `logger.Logger`.
:param check: Whether to raise a `subprocess.CalledProcessError` when the
command returns a non-zero exit code
:param stdout_loglevel: Which level to use to log stdout. `None` disables logging.
:param stderr_loglevel: Which level to use to log stderr. `None` disables logging.
:param check:
Whether to raise a `subprocess.CalledProcessError` when the
command returns a non-zero exit code
"""
logger = logger or mlog
stdout_logfunc: Callable | None = None
Expand Down Expand Up @@ -102,9 +103,9 @@ async def async_log_run(
def log_run(
args: Sequence[StrOrBytesPath],
logger: TwiggyLogger | StdLogger | None = None,
check: bool = True,
stdout_loglevel: str | None = None,
stderr_loglevel: str | None = 'debug',
check: bool = True,
**kwargs,
) -> subprocess.CompletedProcess:
"""
Expand All @@ -113,5 +114,5 @@ def log_run(
output.
"""
return asyncio.run(
async_log_run(args, logger, check, stdout_loglevel, stderr_loglevel, **kwargs)
async_log_run(args, logger, stdout_loglevel, stderr_loglevel, check, **kwargs)
)

0 comments on commit c0cb66a

Please sign in to comment.