Skip to content

Commit

Permalink
py(deps) libtmux 0.40.1 -> 0.42.0, modernize run_before_script() (#958
Browse files Browse the repository at this point in the history
  • Loading branch information
tony authored Feb 2, 2025
2 parents a7db220 + 919324f commit eb14202
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force

<!-- Maintainers, insert changes / features for the next release here -->

### Development

- libtmux: Bump minimum version from 0.40.1 -> 0.42.0 (#958)

- `run_before_script()`: Remove reliance on `console_to_str()`

## tmuxp 1.51.0 (2025-02-02)

_Maintenance only, no bug fixes or new features_
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ include = [
{ path = "conftest.py", format = "sdist" },
]
dependencies = [
"libtmux~=0.40.1",
"libtmux~=0.42.0",
"colorama>=0.3.9",
"PyYAML>=6.0"
]
Expand Down
11 changes: 6 additions & 5 deletions src/tmuxp/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import sys
import typing as t

from libtmux._compat import console_to_str

from . import exc

if t.TYPE_CHECKING:
Expand All @@ -37,16 +35,19 @@ def run_before_script(
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
cwd=cwd,
text=True,
errors="backslashreplace",
encoding="utf-8",
)
if proc.stdout is not None:
for line in iter(proc.stdout.readline, b""):
sys.stdout.write(console_to_str(line))
for line in iter(proc.stdout.readline, ""):
sys.stdout.write(line)
proc.wait()

if proc.returncode and proc.stderr is not None:
stderr = proc.stderr.read()
proc.stderr.close()
stderr_strlist = console_to_str(stderr).split("\n")
stderr_strlist = stderr.split("\n")
stderr_str = "\n".join(list(filter(None, stderr_strlist))) # filter empty

raise exc.BeforeLoadScriptError(
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb14202

Please sign in to comment.