A context manager that performs actions in the given directory.
(dir)
| 222 | |
| 223 | @contextlib.contextmanager |
| 224 | def chdir(dir): |
| 225 | """A context manager that performs actions in the given directory.""" |
| 226 | orig_cwd = os.getcwd() |
| 227 | os.chdir(dir) |
| 228 | try: |
| 229 | yield |
| 230 | finally: |
| 231 | os.chdir(orig_cwd) |
| 232 | |
| 233 | |
| 234 | def make_executable(name): |