in linux/cuda_installer/os_installers/__init__.py [0:0]
def chdir(path: Union[pathlib.Path, str]):
"""
Switch the current working directory for a while. Restore the previous one on context exit.
"""
prev = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(prev)