Step into a directory temporarily.
| 127 | |
| 128 | |
| 129 | class ChDir(object): |
| 130 | """ |
| 131 | Step into a directory temporarily. |
| 132 | """ |
| 133 | |
| 134 | def __init__(self, path): |
| 135 | self.old_dir = os.getcwd() |
| 136 | self.new_dir = str(path) |
| 137 | |
| 138 | def __enter__(self): |
| 139 | os.chdir(self.new_dir) |
| 140 | |
| 141 | def __exit__(self, *args): |
| 142 | os.chdir(self.old_dir) |
| 143 | |
| 144 | |
| 145 | def run_code(executor, code): |
no outgoing calls