Avoid crash described in issue #39
This commit is contained in:
parent
83064d7c90
commit
56e354f124
1 changed files with 14 additions and 11 deletions
|
|
@ -271,18 +271,21 @@ def run_badblocks():
|
||||||
print_standard('Done', timestamp=False)
|
print_standard('Done', timestamp=False)
|
||||||
|
|
||||||
# Check results
|
# Check results
|
||||||
with open(progress_file, 'r') as f:
|
if os.path.exists(progress_file):
|
||||||
text = f.read()
|
with open(progress_file, 'r') as f:
|
||||||
TESTS['badblocks']['Results'][name] = text
|
text = f.read()
|
||||||
r = re.search(r'Pass completed.*0/0/0 errors', text)
|
TESTS['badblocks']['Results'][name] = text
|
||||||
if r:
|
r = re.search(r'Pass completed.*0/0/0 errors', text)
|
||||||
TESTS['badblocks']['Status'][name] = 'CS'
|
if r:
|
||||||
else:
|
TESTS['badblocks']['Status'][name] = 'CS'
|
||||||
TESTS['badblocks']['Status'][name] = 'NS'
|
else:
|
||||||
|
TESTS['badblocks']['Status'][name] = 'NS'
|
||||||
|
|
||||||
# Move temp file
|
# Move temp file
|
||||||
shutil.move(progress_file, '{}/badblocks-{}.log'.format(
|
shutil.move(progress_file, '{}/badblocks-{}.log'.format(
|
||||||
global_vars['LogDir'], name))
|
global_vars['LogDir'], name))
|
||||||
|
else:
|
||||||
|
TESTS['badblocks']['Status'][name] = 'NS'
|
||||||
update_progress()
|
update_progress()
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue