Skip to content

Commit

Permalink
set info activity for failing shell commands
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWilhelm committed Feb 1, 2022
1 parent ab92d07 commit 803bc3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pyscaffold/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def email() -> str:
host = socket.gethostname()
mail = f"{user}@{host}"
except Exception as ex:
logger.debug("Impossible to find user/hostname", exc_info=True)
logger.debug("Impossible to determine email", exc_info=True)
raise GitNotConfigured from ex
return mail

Expand Down Expand Up @@ -344,7 +344,7 @@ def config_dir(prog=PKG_NAME, org=None, default=RAISE_EXCEPTION):
return Path(appdirs.user_config_dir(prog, org, roaming=True))
except Exception as ex:
if default is not RAISE_EXCEPTION:
logger.debug("Error when trying to find config dir %s", ex, exc_info=True)
logger.debug("Error when finding config dir %s", ex, exc_info=True)
return default
raise ImpossibleToFindConfigDir() from ex

Expand Down
4 changes: 2 additions & 2 deletions src/pyscaffold/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __call__(self, *args, **kwargs) -> Iterator[str]:
completed = self.run(*args, **kwargs)
except FileNotFoundError as e:
msg = f"{e.strerror}: {e.filename}"
logger.debug(f'last command failed with "{msg}"')
logger.report("info", f'last command failed with "{msg}"')
raise ShellCommandException(msg) from e

try:
Expand All @@ -116,7 +116,7 @@ def __call__(self, *args, **kwargs) -> Iterator[str]:
stdout, stderr = (e.strip() for e in (stdout, stderr))
sep = "; " if stdout and stderr else ""
msg = sep.join([stdout, stderr])
logger.debug(f'last command failed with "{msg}"')
logger.report("info", f'last command failed with "{msg}"')
raise ShellCommandException(msg) from e

return (line for line in (completed.stdout or "").splitlines())
Expand Down

0 comments on commit 803bc3c

Please sign in to comment.