From de146690add072ca53ef11f6cb421eed45958da0 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 19 Oct 2021 13:47:11 +0200 Subject: [PATCH] Apply suggestions from code review --- tljh/conda.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tljh/conda.py b/tljh/conda.py index 1dbeb55..1ffe7ff 100644 --- a/tljh/conda.py +++ b/tljh/conda.py @@ -51,8 +51,10 @@ def download_miniconda_installer(installer_url, sha256sum): """ with tempfile.NamedTemporaryFile('wb') as f: f.write(requests.get(installer_url).content) + # Remain in the NamedTemporaryFile context, but flush changes, see: + # https://docs.python.org/3/library/os.html#os.fsync f.flush() - os.fsync(f) + os.fsync(f.fileno()) if sha256_file(f.name) != sha256sum: raise Exception('sha256sum hash mismatch! Downloaded file corrupted')