mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #3713
3713: Retry hdiutil create if it fails (fixes #3711) r=heinrich5991 a=def- <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
af935dcb47
|
@ -4,6 +4,7 @@ import os
|
|||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
ConfigDmgtools = namedtuple('Config', 'dmg hfsplus newfs_hfs verbose')
|
||||
ConfigHdiutil = namedtuple('Config', 'hdiutil verbose')
|
||||
|
@ -72,7 +73,16 @@ class Hdiutil(Dmg):
|
|||
def create(self, dmg, volume_name, directory, symlinks):
|
||||
if symlinks:
|
||||
raise NotImplementedError("symlinks are not yet implemented")
|
||||
self._hdiutil('create', '-volname', volume_name, '-srcdir', directory, dmg)
|
||||
for i in range(5):
|
||||
try:
|
||||
self._hdiutil('create', '-volname', volume_name, '-srcdir', directory, dmg)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if i == 4:
|
||||
raise e
|
||||
print("Retrying hdiutil create")
|
||||
time.sleep(5)
|
||||
else:
|
||||
break
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description="Manipulate dmg archives")
|
||||
|
|
Loading…
Reference in a new issue