mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 10:12:38 +02:00
qubes: Log captured output for the second stage
Log the captured command output during the second stage, only in dev environments. This follows what we have already done for the first stage.
This commit is contained in:
parent
16603875d6
commit
b7b76174ab
1 changed files with 14 additions and 1 deletions
|
@ -24,7 +24,12 @@ from ..util import (
|
||||||
get_tmp_dir,
|
get_tmp_dir,
|
||||||
nonblocking_read,
|
nonblocking_read,
|
||||||
)
|
)
|
||||||
from .base import MAX_CONVERSION_LOG_CHARS, IsolationProvider
|
from .base import (
|
||||||
|
MAX_CONVERSION_LOG_CHARS,
|
||||||
|
PIXELS_TO_PDF_LOG_END,
|
||||||
|
PIXELS_TO_PDF_LOG_START,
|
||||||
|
IsolationProvider,
|
||||||
|
)
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -167,6 +172,14 @@ class Qubes(IsolationProvider):
|
||||||
asyncio.run(converter.convert(ocr_lang))
|
asyncio.run(converter.convert(ocr_lang))
|
||||||
except (RuntimeError, TimeoutError, ValueError) as e:
|
except (RuntimeError, TimeoutError, ValueError) as e:
|
||||||
raise errors.UnexpectedConversionError(str(e))
|
raise errors.UnexpectedConversionError(str(e))
|
||||||
|
finally:
|
||||||
|
if getattr(sys, "dangerzone_dev", False):
|
||||||
|
out = converter.captured_output.decode()
|
||||||
|
text = (
|
||||||
|
f"Conversion output: (pixels to PDF)\n"
|
||||||
|
f"{PIXELS_TO_PDF_LOG_START}\n{out}{PIXELS_TO_PDF_LOG_END}"
|
||||||
|
)
|
||||||
|
log.info(text)
|
||||||
|
|
||||||
shutil.move(CONVERTED_FILE_PATH, document.output_filename)
|
shutil.move(CONVERTED_FILE_PATH, document.output_filename)
|
||||||
success = True
|
success = True
|
||||||
|
|
Loading…
Reference in a new issue