File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
mkdocs_git_authors_plugin Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 99import os
1010from contextlib import contextmanager
1111import logging
12-
12+ from pathlib import Path
13+ from typing import Union
1314from mkdocs_git_authors_plugin .git .command import GitCommand
1415
1516
1617@contextmanager
17- def working_directory (path ):
18+ def working_directory (path : Union [ str , Path ] ):
1819 """
1920 Temporarily change working directory.
2021 A context manager which changes the working directory to the given
@@ -26,13 +27,13 @@ def working_directory(path):
2627 # Do something in new directory
2728 # Back to old directory
2829 ```
29- """
30- prev_cwd = os .getcwd ()
31- os .chdir (str (path ))
30+ """
31+ origin = Path ().absolute ()
3232 try :
33+ os .chdir (path )
3334 yield
3435 finally :
35- os .chdir (prev_cwd )
36+ os .chdir (origin )
3637
3738
3839def raise_ci_warnings (path : str ) -> None :
You can’t perform that action at this time.
0 commit comments