Skip to content

darwin: fix crash when tmp is incomplete #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions MSET9_installer_script/mset9.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ def run_diskutil_and_wait(command, dev):
if dirname.startswith(tmpprefix):
dirpath = f"{systmp}/{dirname}"
script = f"{dirpath}/mset9.py"
tmp_st = os.stat(script)
this_st = os.stat(thisfile)
# hope file size is enough fix... checksum is a bit heavy i assume
if os.path.exists(script) and tmp_st.st_mtime > this_st.st_mtime and tmp_st.st_size == this_st.st_size:
tmpdir = dirpath
break
else:
shutil.rmtree(dirpath)
if os.path.exists(script):
tmp_st = os.stat(script)
this_st = os.stat(thisfile)
# hope file size is enough fix... checksum is a bit heavy i assume
if tmp_st.st_mtime > this_st.st_mtime and tmp_st.st_size == this_st.st_size:
tmpdir = dirpath
break
shutil.rmtree(dirpath)
if tmpdir is None:
prinfo("Creating temporary folder...")
tmpdir = tempfile.mkdtemp(prefix=tmpprefix)
Expand Down