Fixed CoreStorage scanning
* Dropped use of mktemp since sudo was interferrring * Fixed crash if timeout occurred
This commit is contained in:
parent
25c532881e
commit
9c95dcbd5c
1 changed files with 4 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import subprocess
|
|||
from wk import std
|
||||
from wk.exe import popen_program, run_program
|
||||
from wk.hw.obj import Disk
|
||||
from wk.log import format_log_path
|
||||
|
||||
|
||||
# STATIC VARIABLES
|
||||
|
|
@ -181,7 +182,7 @@ def scan_corestorage_container(container, timeout=300):
|
|||
# TODO: Test Scanning CoreStorage containers
|
||||
detected_volumes = {}
|
||||
inner_volumes = []
|
||||
log_path = make_temp_file()
|
||||
log_path = format_log_path(log_name=f'{container.path.name}_testdisk')
|
||||
|
||||
# Run scan via TestDisk
|
||||
cmd = [
|
||||
|
|
@ -191,12 +192,12 @@ def scan_corestorage_container(container, timeout=300):
|
|||
'/log',
|
||||
'/cmd', container.path, 'partition_none,analyze',
|
||||
]
|
||||
proc = popen_program(cmd)
|
||||
proc = popen_program(cmd, pipe=True)
|
||||
try:
|
||||
proc.wait(timeout=timeout)
|
||||
except subprocess.TimeoutExpired:
|
||||
# Failed to find any volumes, stop scan
|
||||
run_program(['sudo', 'kill', proc.pid], check=False)
|
||||
run_program(['sudo', 'kill', str(proc.pid)], check=False)
|
||||
|
||||
# Check results
|
||||
if proc.returncode == 0 and log_path.exists():
|
||||
|
|
|
|||
Loading…
Reference in a new issue