mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Containers: remove debug messages (via files)
Remove container_log messages ahead of debug info being sent over standard streams.
This commit is contained in:
parent
dca46d0a6b
commit
331b6514e8
3 changed files with 2 additions and 31 deletions
|
@ -309,10 +309,6 @@ async def main() -> int:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
converter.update_progress(str(e), error=True)
|
converter.update_progress(str(e), error=True)
|
||||||
error_code = errors.UnexpectedConversionError.error_code
|
error_code = errors.UnexpectedConversionError.error_code
|
||||||
if not running_on_qubes():
|
|
||||||
# Write debug information (containers version)
|
|
||||||
with open("/tmp/dangerzone/captured_output.txt", "wb") as container_log:
|
|
||||||
container_log.write(converter.captured_output)
|
|
||||||
return error_code
|
return error_code
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,17 +97,10 @@ async def main() -> int:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await converter.convert(ocr_lang)
|
await converter.convert(ocr_lang)
|
||||||
error_code = 0 # Success!
|
return 0
|
||||||
|
|
||||||
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)
|
||||||
error_code = 1
|
return 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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -296,14 +296,6 @@ class Container(IsolationProvider):
|
||||||
]
|
]
|
||||||
ret = self.exec_container(document, command, extra_args)
|
ret = self.exec_container(document, command, extra_args)
|
||||||
|
|
||||||
if getattr(sys, "dangerzone_dev", False):
|
|
||||||
log_path = pixel_dir / "captured_output.txt"
|
|
||||||
with open(log_path, "r", encoding="ascii", errors="replace") as f:
|
|
||||||
untrusted_log = f.read(MAX_CONVERSION_LOG_CHARS)
|
|
||||||
log.info(
|
|
||||||
f"Conversion output (doc to pixels):\n{self.sanitize_conversion_str(untrusted_log)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
log.error("documents-to-pixels failed")
|
log.error("documents-to-pixels failed")
|
||||||
|
|
||||||
|
@ -348,16 +340,6 @@ 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"
|
|
||||||
if log_path.exists(): # If first stage failed this may not exist
|
|
||||||
with open(log_path, "r", encoding="ascii", errors="replace") as f:
|
|
||||||
text = (
|
|
||||||
f"Container output: (pixels to PDF)\n"
|
|
||||||
f"{PIXELS_TO_PDF_LOG_START}\n{f.read()}{PIXELS_TO_PDF_LOG_END}"
|
|
||||||
)
|
|
||||||
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