Skip to content

Commit cda6c79

Browse files
committed
types(server[new_window]) Use StrPath for start_directory
1 parent ee32e7e commit cda6c79

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libtmux/session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import sys
3535
import types
3636

37+
from libtmux._internal.types import StrPath
3738
from libtmux.common import tmux_cmd
3839

3940
if sys.version_info >= (3, 11):
@@ -587,7 +588,7 @@ def new_window(
587588
self,
588589
window_name: str | None = None,
589590
*,
590-
start_directory: str | None = None,
591+
start_directory: StrPath | None = None,
591592
attach: bool = False,
592593
window_index: str = "",
593594
window_shell: str | None = None,
@@ -677,7 +678,8 @@ def new_window(
677678

678679
window_args += ("-P",)
679680

680-
if start_directory is not None:
681+
# Catch empty string and default (`None`)
682+
if start_directory and isinstance(start_directory, str):
681683
# as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c.
682684
start_directory = pathlib.Path(start_directory).expanduser()
683685
window_args += (f"-c{start_directory}",)

0 commit comments

Comments
 (0)