Skip to content

Commit cc3541a

Browse files
clone repos without chdir
1 parent ddff0af commit cc3541a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

app/get_knowledge_base.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,15 @@ def setup_repositories():
2727
"defang": "https://github.com/DefangLabs/defang.git"
2828
}
2929

30-
# Change to the temporary directory
31-
original_dir = os.getcwd()
32-
os.chdir(tmp_dir)
33-
3430
# Clone each repository
3531
for repo_name, repo_url in repos.items():
36-
clone_repository(repo_url, repo_name)
37-
38-
# Return to the original directory
39-
os.chdir(original_dir)
32+
clone_repository(repo_url, os.path.join(tmp_dir, repo_name))
4033

4134
def run_prebuild_script():
4235
""" Run the 'prebuild.sh' script located in the .tmp directory. """
4336
os.chdir(".tmp")
4437
script_path = os.path.join("./", "prebuild.sh") # Ensure the path is correct
38+
os.chdir("..")
4539
if os.path.exists(script_path):
4640
print("Running prebuild.sh...")
4741
try:
@@ -172,8 +166,5 @@ def recursive_parse_directory(root_dir):
172166
if __name__ == "__main__":
173167
setup_repositories()
174168
run_prebuild_script()
175-
os.chdir('../../')
176-
print(os.listdir('.'))
177169
parse_markdown() # Start parsing logic after all setups
178-
print(os.listdir('.'))
179170
print("All processes completed successfully.")

0 commit comments

Comments
 (0)