Restore original working dir after extraction
@@ -187,8 +187,10 @@ def extract_source(revision_key, location, runtime):
app_path = os.path.join(revision_base, 'app')
ensure_path(app_path)
# The working directory must be the target in order to validate paths.
+ original_cwd = os.getcwd()
os.chdir(app_path)
+ try:
with tarfile.open(location, 'r:gz') as archive:
# Check if the archive is valid before extracting it.
has_config = False
@@ -229,6 +231,8 @@ def extract_source(revision_key, location, runtime):
if runtime == JAVA:
remove_conflicting_jars(app_path)
copy_modified_jars(app_path)
+ finally:
+ os.chdir(original_cwd)
def port_is_open(host, port):
