Permalink
Browse files

Scripts: Fix erroneous error report

If a script is re-run using the -continue option, and the -nocleanup option is also used, then the file 'error.txt' resulting from the prior script failure will be detected and erroneously echoed to the command-line as an error. This is solved simply by erasing file 'error.txt' when the -continue option is used.
  • Loading branch information...
Lestropie committed Mar 27, 2018
1 parent 3bbf8d4 commit ba85d75ef88f8b42e180292aba0e29be4b198fc1
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/mrtrix3/app.py
@@ -181,6 +181,12 @@ def parse(): #pylint: disable=unused-variable
if hasattr(args, 'cont') and args.cont:
continueOption = True
tempDir = os.path.abspath(args.cont[0])
# Prevent error from re-appearing at end of terminal output if script continuation results in success
# and -nocleanup is used
try:
os.remove(os.path.join(tempDir, 'error.txt'))
except OSError:
pass
run.setContinue(args.cont[1])


0 comments on commit ba85d75

Please sign in to comment.