mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
allow to pass logger to _subprocess
This commit is contained in:
parent
ffa16729df
commit
63b7a2a244
1 changed files with 5 additions and 2 deletions
|
|
@ -81,8 +81,7 @@ def get_ffmpeg_tool_path(tool="ffmpeg"):
|
|||
|
||||
|
||||
# Special naming case for subprocess since its a built-in method.
|
||||
def _subprocess(*args, **kwargs):
|
||||
"""Convenience method for getting output errors for subprocess."""
|
||||
def _subprocess(*args, logger=None, **kwargs):
|
||||
|
||||
# Get environents from kwarg or use current process environments if were
|
||||
# not passed.
|
||||
|
|
@ -90,6 +89,10 @@ def _subprocess(*args, **kwargs):
|
|||
# Make sure environment contains only strings
|
||||
filtered_env = {k: str(v) for k, v in env.items()}
|
||||
|
||||
# Use lib's logger if was not passed with kwargs.
|
||||
if not logger:
|
||||
logger = log
|
||||
|
||||
# set overrides
|
||||
kwargs['stdout'] = kwargs.get('stdout', subprocess.PIPE)
|
||||
kwargs['stderr'] = kwargs.get('stderr', subprocess.STDOUT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue