mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Add logging for second container
This commit is contained in:
parent
75369cf621
commit
fa215063ee
2 changed files with 16 additions and 3 deletions
|
@ -156,11 +156,17 @@ async def main() -> int:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await converter.convert()
|
await converter.convert()
|
||||||
|
error_code = 0 # Success!
|
||||||
|
|
||||||
except (RuntimeError, TimeoutError, ValueError) as e:
|
except (RuntimeError, TimeoutError, ValueError) as e:
|
||||||
converter.update_progress(str(e), error=True)
|
converter.update_progress(str(e), error=True)
|
||||||
return 1
|
error_code = 1
|
||||||
else:
|
|
||||||
return 0 # Success!
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -337,6 +337,13 @@ class Container(IsolationProvider):
|
||||||
# We did it
|
# We did it
|
||||||
success = True
|
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
|
return success
|
||||||
|
|
||||||
def get_max_parallel_conversions(self) -> int:
|
def get_max_parallel_conversions(self) -> int:
|
||||||
|
|
Loading…
Reference in a new issue