Only open ddrescueview if running with a DISPLAY

This commit is contained in:
2Shirt 2022-03-08 12:36:49 -07:00
parent b82493b12b
commit b66f25dfea
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -133,11 +133,7 @@ class BlockPair():
'trim': 'Pending',
'scrape': 'Pending',
})
self.view_proc = 'Disabled'
if 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ:
# Enable opening ddrescueview during recovery
self.view_proc = None
self.view_map = 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ
# Set map path
# e.g. '(Clone|Image)_Model[_p#]_Size[_Label].map'
@ -2054,12 +2050,13 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
LOG.info('ddrescue cmd: %s', cmd)
return
# Start ddrescue and ddrescueview
# Start ddrescue and ddrescueview (if enabled)
proc = exe.popen_program(cmd)
exe.popen_program(
['ddrescueview', '-r', '5s', block_pair.map_path],
pipe=True,
)
if block_pair.view_map:
exe.popen_program(
['ddrescueview', '-r', '5s', block_pair.map_path],
pipe=True,
)
# ddrescue loop
_i = 0