| 746 | } |
| 747 | |
| 748 | int main(int args_size, char *args[]) |
| 749 | { |
| 750 | std::ios::sync_with_stdio(false); |
| 751 | int errorcode = 0; |
| 752 | try { |
| 753 | covscript_main(args_size, args); |
| 754 | } |
| 755 | catch (const std::exception &e) { |
| 756 | if (!log_path.empty()) { |
| 757 | std::ofstream out(::log_path); |
| 758 | if (out) { |
| 759 | out << e.what(); |
| 760 | out.flush(); |
| 761 | } |
| 762 | else |
| 763 | std::cerr << "Write log failed." << std::endl; |
| 764 | } |
| 765 | std::cerr << e.what() << std::endl; |
| 766 | errorcode = -1; |
| 767 | } |
| 768 | catch (...) { |
| 769 | if (!log_path.empty()) { |
| 770 | std::ofstream out(::log_path); |
| 771 | if (out) { |
| 772 | out << "Uncaught exception: Unknown exception"; |
| 773 | out.flush(); |
| 774 | } |
| 775 | else |
| 776 | std::cerr << "Write log failed." << std::endl; |
| 777 | } |
| 778 | std::cerr << "Uncaught exception: Unknown exception" << std::endl; |
| 779 | errorcode = -1; |
| 780 | } |
| 781 | if (wait_before_exit) { |
| 782 | std::cerr << "\nProcess finished with exit code " << errorcode << std::endl; |
| 783 | std::cerr << "\nPress any key to exit..." << std::endl; |
| 784 | while (!cs_impl::conio::kbhit()); |
| 785 | cs_impl::conio::getch(); |
| 786 | } |
| 787 | return errorcode; |
| 788 | } |
nothing calls this directly
no test coverage detected