mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
mirror: make _run_wget() return to the dir it started in
This kind of function should not change the working environment, especially since so much of the fdroidserver code assumes the current working directory is the root of an fdroid repo. It is used in fdroidserver/mirror.py with absolute paths always, so it shouldn't change any existing use. I found this issue by using it in a plugin.
This commit is contained in:
parent
319bf47a6b
commit
c54f9ea4ca
@ -27,6 +27,7 @@ def _run_wget(path, urls):
|
||||
if not urls:
|
||||
return
|
||||
logging.debug(_('Running wget in {path}').format(path=path))
|
||||
cwd = os.getcwd()
|
||||
os.makedirs(path, exist_ok=True)
|
||||
os.chdir(path)
|
||||
urls_file = '.fdroid-mirror-wget-input-file'
|
||||
@ -43,6 +44,7 @@ def _run_wget(path, urls):
|
||||
]
|
||||
)
|
||||
os.remove(urls_file)
|
||||
os.chdir(cwd) # leave the working env the way we found it
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user