github.com/attic-labs/noms@v0.0.0-20210827224422-e5fa29d95e8b/tools/noms/pushd.py (about) 1 #!/usr/bin/python 2 3 # Copyright 2016 Attic Labs, Inc. All rights reserved. 4 # Licensed under the Apache License, version 2.0: 5 # http://www.apache.org/licenses/LICENSE-2.0 6 7 import os 8 from contextlib import contextmanager 9 10 @contextmanager 11 def pushd(path): 12 currentDir = os.getcwd() 13 os.chdir(path) 14 yield 15 os.chdir(currentDir)