Skip to content

Commit 79f6012

Browse files
clone repos without chdir
1 parent 332ff79 commit 79f6012

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
@@ -28,21 +28,15 @@ def setup_repositories():
2828
"samples": "https://github.com/DefangLabs/samples.git"
2929
}
3030

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

4235
def run_prebuild_script():
4336
""" Run the 'prebuild.sh' script located in the .tmp directory. """
4437
os.chdir(".tmp")
4538
script_path = os.path.join("./", "prebuild.sh") # Ensure the path is correct
39+
os.chdir("..")
4640
if os.path.exists(script_path):
4741
print("Running prebuild.sh...")
4842
try:
@@ -173,8 +167,5 @@ def recursive_parse_directory(root_dir):
173167
if __name__ == "__main__":
174168
setup_repositories()
175169
run_prebuild_script()
176-
os.chdir('../../')
177-
print(os.listdir('.'))
178170
parse_markdown() # Start parsing logic after all setups
179-
print(os.listdir('.'))
180171
print("All processes completed successfully.")

0 commit comments

Comments
 (0)