mirror of
https://github.com/daylinmorgan/viv.git
synced 2025-01-22 13:27:31 -06:00
fix: only log debug if not error
This commit is contained in:
parent
1a254a5441
commit
694b57d5fa
1 changed files with 8 additions and 9 deletions
|
@ -53,7 +53,7 @@ from typing import (
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
__version__ = "23.8a1-15-g3a2832e-dev"
|
__version__ = "23.8a1-16-g1a254a5-dev"
|
||||||
|
|
||||||
|
|
||||||
class Spinner:
|
class Spinner:
|
||||||
|
@ -729,8 +729,7 @@ def run(
|
||||||
verbose: If true, print subcommand output.
|
verbose: If true, print subcommand output.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: remove 'verbose' and rely on log level?
|
log.debug("executing subcmd:\n " + " ".join(command))
|
||||||
log.debug("executing subcmd\n\t" + " ".join(command))
|
|
||||||
|
|
||||||
if spinmsg and not verbose:
|
if spinmsg and not verbose:
|
||||||
with Spinner(spinmsg):
|
with Spinner(spinmsg):
|
||||||
|
@ -748,11 +747,6 @@ def run(
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not verbose:
|
|
||||||
log.debug(
|
|
||||||
"output:\n" + "\n".join(f"-> {line}" for line in p.stdout.splitlines())
|
|
||||||
)
|
|
||||||
|
|
||||||
if p.returncode != 0 and not ignore_error:
|
if p.returncode != 0 and not ignore_error:
|
||||||
a.subprocess(command, p.stdout)
|
a.subprocess(command, p.stdout)
|
||||||
|
|
||||||
|
@ -761,7 +755,12 @@ def run(
|
||||||
|
|
||||||
sys.exit(p.returncode)
|
sys.exit(p.returncode)
|
||||||
|
|
||||||
elif check_output:
|
if not verbose:
|
||||||
|
log.debug(
|
||||||
|
"output:\n" + "\n".join(f"-> {line}" for line in p.stdout.splitlines())
|
||||||
|
)
|
||||||
|
|
||||||
|
if check_output:
|
||||||
return p.stdout
|
return p.stdout
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue