MCPcopy Create free account
hub / github.com/covscript/covscript / main

Function main

sources/interpreter.cpp:362–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362int main(int args_size, char *args[])
363{
364 std::ios::sync_with_stdio(false);
365 int errorcode = 0;
366 try {
367 covscript_main(args_size, args);
368 errorcode = cs::current_process->exit_code;
369 }
370 catch (const std::exception &e) {
371 if (!log_path.empty()) {
372 std::ofstream out(::log_path);
373 if (out) {
374 out << e.what();
375 out.flush();
376 }
377 else
378 std::cerr << "Write log failed." << std::endl;
379 }
380 std::cerr << e.what() << std::endl;
381 errorcode = -1;
382 }
383 catch (...) {
384 if (!log_path.empty()) {
385 std::ofstream out(::log_path);
386 if (out) {
387 out << "Uncaught exception: Unknown exception";
388 out.flush();
389 }
390 else
391 std::cerr << "Write log failed." << std::endl;
392 }
393 std::cerr << "Uncaught exception: Unknown exception" << std::endl;
394 errorcode = -1;
395 }
396 if (wait_before_exit) {
397 std::cerr << "\nProcess finished with exit code " << errorcode << std::endl;
398 std::cerr << "\nPress any key to exit..." << std::endl;
399 while (!cs_impl::conio::kbhit());
400 cs_impl::conio::getch();
401 }
402 return errorcode;
403}

Callers

nothing calls this directly

Calls 5

covscript_mainFunction · 0.70
kbhitFunction · 0.50
getchFunction · 0.50
emptyMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected