Open ddrescueview only once per BlockPair

This commit is contained in:
2Shirt 2022-10-08 15:41:54 -07:00
parent 6880a353cc
commit fc8f81b66d
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -146,6 +146,7 @@ class BlockPair():
'scrape': 'Pending', 'scrape': 'Pending',
}) })
self.view_map = 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ self.view_map = 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ
self.view_proc = None
# Set map path # Set map path
# e.g. '(Clone|Image)_Model[_p#]_Size[_Label].map' # e.g. '(Clone|Image)_Model[_p#]_Size[_Label].map'
@ -2088,8 +2089,8 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
# Start ddrescue and ddrescueview (if enabled) # Start ddrescue and ddrescueview (if enabled)
proc = exe.popen_program(cmd) proc = exe.popen_program(cmd)
if block_pair.view_map: if block_pair.view_map and not block_pair.view_proc:
exe.popen_program( block_pair.view_proc = exe.popen_program(
['ddrescueview', '-r', '5s', block_pair.map_path], ['ddrescueview', '-r', '5s', block_pair.map_path],
pipe=True, pipe=True,
) )