Commits

anatoly techtonik committed 91a1aa5

test/util/support: Save/restore standard streams if redirecting

  • Participants
  • Parent commits 5a9af21
  • Branches tests-logfile

Comments (0)

Files changed (1)

File sdl2/test/util/runtests.py

     validate_args(options)
     if options.logfile:
         openlog = open(options.logfile, 'wb')
+        savedstd = sys.stderr, sys.stdout
         # copy stdout and stderr streams to log file
         sys.stderr = support.TeeOutput(sys.stderr, openlog)
         sys.stdout = support.TeeOutput(sys.stdout, openlog)
             writer.writeline(HEAVYDELIM)
             writer.writeline(fail[1])
     if options.logfile:
+        sys.stderr, sys.stdout = savedstd
         openlog.close()
     if len(errors) > 0 or len(failures) > 0:
         return 1