mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(ea): a failed touchup is retried and its output reaches the store log (#2505)
* fix(ea): a failed touchup is retried and its output reaches the store log * fix(ea): bound the touchup output kept for the store log The output goes to a temporary file and only its last 64 KiB are read back. The timeout test now checks the output is logged and the next launch retries. * fix(ea): a touchup still runs when its output cannot be captured
This commit is contained in:
1 parent
8f4cefd3bd
commit
8f4744398d
2 files changed
+119
-1
No files matched your search
@@ -1479,14 +1479,32 @@ def ea_touchup(folder, sidecar, compat_data, proton, timeout=900):
|
||||
except OSError:
|
||||
pass
|
||||
args = touchup_args(str(extra.get("touchupArgs") or ""), str(extra.get("locale") or "en_US"), windows_path(str(folder)).rstrip("\\"))
|
||||
try:
|
||||
sink = tempfile.TemporaryFile()
|
||||
except OSError:
|
||||
sink = None
|
||||
try:
|
||||
run = subprocess.run([proton, "run", str(exe)] + args, cwd=str(exe.parent), stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=timeout)
|
||||
stdout=sink or subprocess.DEVNULL, stderr=subprocess.STDOUT, timeout=timeout)
|
||||
result = "ok" if run.returncode == 0 else "exit-%d" % run.returncode
|
||||
except subprocess.TimeoutExpired:
|
||||
result = "timeout"
|
||||
except OSError:
|
||||
return "failed"
|
||||
finally:
|
||||
output = b""
|
||||
if sink is not None:
|
||||
try:
|
||||
sink.seek(0, os.SEEK_END)
|
||||
sink.seek(max(0, sink.tell() - 65536))
|
||||
output = sink.read()
|
||||
except OSError:
|
||||
pass
|
||||
sink.close()
|
||||
for line in output.decode("utf-8", "replace").splitlines()[-200:]:
|
||||
log("touchup: " + line)
|
||||
if result != "ok":
|
||||
return result
|
||||
try:
|
||||
marker.write_text(stamp)
|
||||
except OSError:
|
||||
|
||||
Reference in new issue
Block a user