Skip to content

Commit

Permalink
run_cmd: do not emit stderr to console
Browse files Browse the repository at this point in the history
During repo-root probing errors are expected. However, these are emitted
to the caller terminal as we do not internally redirect them. We now
also caputure stderr on run_cmd.

Sample output:
  2024-12-11 09:59:34 - INFO     - kas 4.6 started
  fatal: not a git repository (or any parent up to mount point /)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  abort: no repository found in '/work' (.hg not found)
  fatal: not a git repository (or any parent up to mount point /)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  abort: no repository found in '/work' (.hg not found)
  2024-12-11 09:59:34 - INFO     - Using /repo as root for repository cip-core

Fixes: bbbc087 ("fix(run_cmd): handle not-executable errors")
Signed-off-by: Felix Moessbauer <[email protected]>
  • Loading branch information
fmoessbauer committed Dec 11, 2024
1 parent 93f0158 commit 6de1a4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kas/libkas.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def run_cmd(cmd, cwd, env=None, fail=True):
logging.debug('%s$ %s', cwd, cmdstr)

try:
ret = subprocess_run(cmd, env=env, cwd=cwd, stdout=PIPE)
ret = subprocess_run(cmd, env=env, cwd=cwd, stdout=PIPE, stderr=PIPE)
if ret.returncode and fail:
raise CommandExecError(cmd, ret.returncode)
except FileNotFoundError as ex:
Expand Down

0 comments on commit 6de1a4b

Please sign in to comment.