MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / run

Method run

src/Context.cpp:761–851  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

759
760////////////////////////////////////////////////////////////////////////////////
761int Context::run() {
762 int rc;
763 std::string output;
764
765 try {
766 hooks.onLaunch();
767 rc = dispatch(output);
768 hooks.onExit(); // No chance to update data.
769
770 timer_total.stop();
771 time_total_us += timer_total.total_us();
772
773 std::stringstream s;
774 s << "Perf " << PACKAGE_STRING << ' '
775#ifdef HAVE_COMMIT
776 << COMMIT
777#else
778 << '-'
779#endif
780 << ' ' << Datetime().toISO()
781
782 << " init:" << time_init_us << " load:" << time_load_us
783 << " gc:" << (time_gc_us > 0 ? time_gc_us - time_load_us : time_gc_us)
784 << " filter:" << time_filter_us << " commit:" << time_commit_us << " sort:" << time_sort_us
785 << " render:" << time_render_us << " hooks:" << time_hooks_us << " other:"
786 << time_total_us - time_init_us - time_gc_us - time_filter_us - time_commit_us -
787 time_sort_us - time_render_us - time_hooks_us
788 << " total:" << time_total_us << '\n';
789 debug(s.str());
790 }
791
792 catch (const std::string& message) {
793 error(message);
794 rc = 2;
795 }
796
797 catch (rust::Error& err) {
798 error(err.what());
799 rc = 2;
800 }
801
802 catch (int) {
803 // Hooks can terminate processing by throwing integers.
804 rc = 4;
805 }
806
807 catch (...) {
808 error("Unknown error. Please report.");
809 rc = 3;
810 }
811
812 // Dump all debug messages, controlled by rc.debug.
813 if (config.getBoolean("debug")) {
814 for (auto& d : debugMessages)
815 if (color())
816 std::cerr << colorizeDebug(d) << '\n';
817 else
818 std::cerr << d << '\n';

Callers 1

mainFunction · 0.80

Calls 7

colorFunction · 0.85
colorizeDebugFunction · 0.85
colorizeHeaderFunction · 0.85
colorizeFootnoteFunction · 0.85
colorizeErrorFunction · 0.85
onLaunchMethod · 0.80
onExitMethod · 0.80

Tested by

no test coverage detected