Software /
code /
prosody
Comparison
prosodyctl @ 12863:891edd1ebde6 0.12
util.startup: Close state on exit to ensure GC finalizers are called
Ensures a last round of garbage collection and that finalizers are
called. Fixes things like proper closing of SQLite3 state.
There are more calls to os.exit() but most of them exit with an error or
in a case where a final GC sweep might not matter as much.
It would be nice if this was the default.
Calling util.statup.exit() everywhere may be sensible, but would be more
involved, requiring imports everywhere.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 22 Jan 2023 14:45:47 +0100 |
parent | 12452:c475a7802169 |
child | 12864:9f9633364044 |
child | 13057:20b1526772d2 |
comparison
equal
deleted
inserted
replaced
12862:3dfb87814d65 | 12863:891edd1ebde6 |
---|---|
661 end | 661 end |
662 | 662 |
663 local ok, ret = modulemanager.call_module_method(module, "command", arg); | 663 local ok, ret = modulemanager.call_module_method(module, "command", arg); |
664 if ok then | 664 if ok then |
665 if type(ret) == "number" then | 665 if type(ret) == "number" then |
666 os.exit(ret); | 666 os.exit(ret, true); |
667 elseif type(ret) == "string" then | 667 elseif type(ret) == "string" then |
668 show_message(ret); | 668 show_message(ret); |
669 end | 669 end |
670 os.exit(0); -- :) | 670 os.exit(0, true); -- :) |
671 else | 671 else |
672 show_message("Failed to execute command: "..error_messages[ret]); | 672 show_message("Failed to execute command: "..error_messages[ret]); |
673 os.exit(1); -- :( | 673 os.exit(1); -- :( |
674 end | 674 end |
675 end | 675 end |
743 done[command_name] = true; | 743 done[command_name] = true; |
744 end | 744 end |
745 end | 745 end |
746 | 746 |
747 | 747 |
748 os.exit(0); | 748 os.exit(0, true); |
749 end | 749 end |
750 | 750 |
751 os.exit(commands[command](arg)); | 751 os.exit(commands[command](arg), true); |
752 end, watchers); | 752 end, watchers); |
753 | 753 |
754 command_runner:run(true); | 754 command_runner:run(true); |