Leave SW Diags window open in D7_MODE on error(s)
This commit is contained in:
parent
4e022ed843
commit
39f947bdd1
1 changed files with 18 additions and 4 deletions
|
|
@ -16,6 +16,17 @@ os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL))
|
|||
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
|
||||
**global_vars)
|
||||
D7_MODE = 'd7mode' in sys.argv
|
||||
ERRORS = 0
|
||||
|
||||
def check_result(result, other_results):
|
||||
"""Check result for warnings and errors."""
|
||||
if not result['CS']:
|
||||
for warning in other_results.get('Warning', {}).keys():
|
||||
if warning in str(result['Error']):
|
||||
# Ignore warnings and repair statements
|
||||
return
|
||||
# Error is not a warning
|
||||
ERRORS += 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
|
@ -58,14 +69,17 @@ if __name__ == '__main__':
|
|||
|
||||
# OS Health Checks
|
||||
print_info('OS Health Checks')
|
||||
try_and_print(
|
||||
result = try_and_print(
|
||||
message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']),
|
||||
function=run_chkdsk, other_results=other_results)
|
||||
try_and_print(message='SFC scan...',
|
||||
check_result(result, other_results)
|
||||
result = try_and_print(message='SFC scan...',
|
||||
function=run_sfc_scan, other_results=other_results)
|
||||
check_result(result, other_results)
|
||||
if D7_MODE:
|
||||
try_and_print(message='DISM RestoreHealth...',
|
||||
result = try_and_print(message='DISM RestoreHealth...',
|
||||
function=run_dism, other_results=other_results, repair=True)
|
||||
check_result(result, other_results)
|
||||
else:
|
||||
try_and_print(message='DISM CheckHealth...',
|
||||
function=run_dism, other_results=other_results, repair=False)
|
||||
|
|
@ -127,7 +141,7 @@ if __name__ == '__main__':
|
|||
print_error(' Unknown error.')
|
||||
|
||||
# Done
|
||||
if not D7_MODE:
|
||||
if not D7_MODE or ERRORS > 0:
|
||||
print_standard('\nDone.')
|
||||
pause('Press Enter to exit...')
|
||||
exit_script()
|
||||
|
|
|
|||
Loading…
Reference in a new issue