diff --git a/invoke/context.py b/invoke/context.py index e9beaf4d..21c5101e 100644 --- a/invoke/context.py +++ b/invoke/context.py @@ -389,7 +389,7 @@ def cd(self, path: Union[PathLike, str]) -> Generator[None, None, None]: (such as the various ``Path`` objects out there), and not just string literals. """ - path = str(path) + path = os.fspath(path) self.command_cwds.append(path) try: yield