# get stack
__, __, exc_traceback = sys.exc_info()
fp = tempfile.TemporaryFile()
- traceback.print_tb(exc_traceback, limit=1, file=fp)
+ traceback.print_tb(exc_traceback, file=fp)
fp.seek(0)
stack = fp.read()
res = 1
logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS),
error), 3)
- logger.write('stack: %s\n' % stack, 3)
+ if len(stack) > 0:
+ logger.write('stack: %s\n' % stack, 3)
# Print the final state
if res == 0:
if logger_add_link:
micro_command = True
logger_command = src.logger.Logger(self.cfg,
- silent_sysstd=silent,
- all_in_terminal=self.options.all_in_terminal,
- micro_command=micro_command)
+ silent_sysstd=silent,
+ all_in_terminal=self.options.all_in_terminal,
+ micro_command=micro_command)
# Check that the path given by the logs_paths_in_file option
# is a file path that can be written
except Exception as e:
msg = _("WARNING: the logs_paths_in_file option will "
"not be taken into account.\nHere is the error:")
- logger_command.write("%s\n%s\n\n" % (src.printcolors.printcWarning(msg), str(e)))
+ logger_command.write("%s\n%s\n\n" % (
+ src.printcolors.printcWarning(msg),
+ str(e)))
self.options.logs_paths_in_file = None
try:
file_res.write(filepath)
if i < len(logger_command.l_logFiles):
file_res.write("\n")
+ file_res.flush()
return res