Skip to content

Commit

Permalink
Prevent extra newline printed by sending .rstrip()'ed line
Browse files Browse the repository at this point in the history
  • Loading branch information
Umit Kablan committed Oct 3, 2024
1 parent ec98698 commit 320ca58
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pleskdistup/common/src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def logged_check_call(cmd: typing.Union[typing.Sequence[str], str], **kwargs) ->
stdout = []

def proc_stdout(line: str) -> None:
if line:
stdout.append(line)
stdout.append(line)

def proc_stderr(line: str) -> None:
log.err(line)
Expand Down Expand Up @@ -54,13 +53,13 @@ def exec_get_output_streamed(
raise RuntimeError(f"Cannot get process stdout of command {cmd!r}")
line = process.stdout.readline()
if line:
process_stdout_line(line)
process_stdout_line(line.rstrip())
if process_stderr_line is not None:
if not process.stderr:
raise RuntimeError(f"Cannot get process stderr of command {cmd!r}")
line = process.stderr.readline()
if line:
process_stderr_line(line)
process_stderr_line(line.rstrip())
return process.returncode


Expand Down

0 comments on commit 320ca58

Please sign in to comment.