Skip to content

Commit

Permalink
Compatibility: Python 3.8 string
Browse files Browse the repository at this point in the history
  • Loading branch information
kammoh committed Jul 17, 2024
1 parent 6bb6cbe commit da5d35a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/xeda/proc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@

log = logging.getLogger(__name__)


def proc_output(is_stderr: bool, line):
print(f"{"[E] " if is_stderr else ""}{line}", end="", file=sys.stderr if is_stderr else sys.stdout)
print(
f"{'[E] ' if is_stderr else ''}{line}", end="", file=sys.stderr if is_stderr else sys.stdout
)


def run_process(
executable: str,
Expand Down Expand Up @@ -168,7 +172,7 @@ def run_capture_pty(command, env=None, cwd=None, check=True, encoding="utf-8"):
elif remainder:
data_str = remainder + data_str
remainder = ""
# spl = re.split(r"\r?\n", data_str) #
# spl = re.split(r"\r?\n", data_str) #
spl = data_str.splitlines(keepends=True)
if spl and not spl[-1].endswith(os.linesep) and not spl[-1].endswith("\n"):
if is_stderr:
Expand Down

0 comments on commit da5d35a

Please sign in to comment.