Add logging for second container

This commit is contained in:
deeplow 2023-08-05 18:37:12 +01:00
parent 75369cf621
commit fa215063ee
No known key found for this signature in database
GPG key ID: 577982871529A52A
2 changed files with 16 additions and 3 deletions

View file

@ -156,11 +156,17 @@ async def main() -> int:
try:
await converter.convert()
error_code = 0 # Success!
except (RuntimeError, TimeoutError, ValueError) as e:
converter.update_progress(str(e), error=True)
return 1
else:
return 0 # Success!
error_code = 1
if not running_on_qubes():
# Write debug information (containers version)
with open("/safezone/captured_output.txt", "wb") as container_log:
container_log.write(converter.captured_output)
return error_code
if __name__ == "__main__":

View file

@ -337,6 +337,13 @@ class Container(IsolationProvider):
# We did it
success = True
if getattr(sys, "dangerzone_dev", False):
log_path = safe_dir / "captured_output.txt"
with open(log_path, "r", encoding="ascii", errors="replace") as f:
untrusted_log = f.read(MAX_CONVERSION_LOG_CHARS)
text = f"Container output: (pixels to PDF)\n{self.sanitize_conversion_str(untrusted_log)}"
log.info(text)
return success
def get_max_parallel_conversions(self) -> int: