mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
13 lines
210 B
Python
13 lines
210 B
Python
|
import os
|
||
|
from contextlib import contextmanager
|
||
|
|
||
|
@contextmanager
|
||
|
def pushd(path):
|
||
|
cwd = os.getcwd()
|
||
|
if not os.path.isdir(path):
|
||
|
os.makedirs(path)
|
||
|
os.chdir(path)
|
||
|
yield
|
||
|
os.chdir(cwd)
|
||
|
|