log stdout if DF fails

develop
lethosor 2021-09-17 16:28:52 -04:00
parent 01077fab0e
commit 0f479d905a
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 2 additions and 1 deletions

@ -112,11 +112,12 @@ try:
stdin=subprocess.PIPE if args.headless else sys.stdin,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_, err = process.communicate()
out, err = process.communicate()
if err:
print('WARN: DF produced stderr: ' + repr(err[:5000]))
if process.returncode != 0:
print('ERROR: DF exited with ' + repr(process.returncode))
print('DF stdout: %r' + repr(out[:5000]))
finally:
print('\nRestoring original init.txt')
shutil.copyfile(init_txt_path + '.orig', init_txt_path)