summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/build.py76
1 files changed, 38 insertions, 38 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 99954b0c26..7e4ab9f64c 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -686,51 +686,51 @@ def _exec_task(fn, task, d, quieterr):
686 try: 686 try:
687 try: 687 try:
688 event.fire(TaskStarted(task, fn, logfn, flags, localdata), localdata) 688 event.fire(TaskStarted(task, fn, logfn, flags, localdata), localdata)
689 except (bb.BBHandledException, SystemExit):
690 return 1
691 689
692 try:
693 for func in (prefuncs or '').split(): 690 for func in (prefuncs or '').split():
694 exec_func(func, localdata) 691 exec_func(func, localdata)
695 exec_func(task, localdata) 692 exec_func(task, localdata)
696 for func in (postfuncs or '').split(): 693 for func in (postfuncs or '').split():
697 exec_func(func, localdata) 694 exec_func(func, localdata)
698 except bb.BBHandledException: 695 finally:
699 event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata) 696 # Need to flush and close the logs before sending events where the
700 return 1 697 # UI may try to look at the logs.
701 except (Exception, SystemExit) as exc: 698 sys.stdout.flush()
702 if quieterr: 699 sys.stderr.flush()
703 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata) 700
704 else: 701 bblogger.removeHandler(handler)
705 errprinted = errchk.triggered 702
706 # If the output is already on stdout, we've printed the information in the 703 # Restore the backup fds
707 # logs once already so don't duplicate 704 os.dup2(osi[0], osi[1])
708 if verboseStdoutLogging: 705 os.dup2(oso[0], oso[1])
709 errprinted = True 706 os.dup2(ose[0], ose[1])
710 logger.error(repr(exc)) 707
711 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata) 708 # Close the backup fds
712 return 1 709 os.close(osi[0])
713 finally: 710 os.close(oso[0])
714 sys.stdout.flush() 711 os.close(ose[0])
715 sys.stderr.flush() 712
716 713 logfile.close()
717 bblogger.removeHandler(handler) 714 if os.path.exists(logfn) and os.path.getsize(logfn) == 0:
718 715 logger.debug2("Zero size logfn %s, removing", logfn)
719 # Restore the backup fds 716 bb.utils.remove(logfn)
720 os.dup2(osi[0], osi[1]) 717 bb.utils.remove(loglink)
721 os.dup2(oso[0], oso[1]) 718 except bb.BBHandledException:
722 os.dup2(ose[0], ose[1]) 719 event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata)
723 720 return 1
724 # Close the backup fds 721 except (Exception, SystemExit) as exc:
725 os.close(osi[0]) 722 if quieterr:
726 os.close(oso[0]) 723 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
727 os.close(ose[0]) 724 else:
725 errprinted = errchk.triggered
726 # If the output is already on stdout, we've printed the information in the
727 # logs once already so don't duplicate
728 if verboseStdoutLogging:
729 errprinted = True
730 logger.error(repr(exc))
731 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
732 return 1
728 733
729 logfile.close()
730 if os.path.exists(logfn) and os.path.getsize(logfn) == 0:
731 logger.debug2("Zero size logfn %s, removing", logfn)
732 bb.utils.remove(logfn)
733 bb.utils.remove(loglink)
734 event.fire(TaskSucceeded(task, fn, logfn, localdata), localdata) 734 event.fire(TaskSucceeded(task, fn, logfn, localdata), localdata)
735 735
736 if not localdata.getVarFlag(task, 'nostamp', False) and not localdata.getVarFlag(task, 'selfstamp', False): 736 if not localdata.getVarFlag(task, 'nostamp', False) and not localdata.getVarFlag(task, 'selfstamp', False):