Software /
code /
prosody
Changeset
12862:3dfb87814d65 0.12
util.prosodyctl.shell: Close state on exit to fix saving shell history
This ensures a last round of garbage collection and finalizers, which
should include flushing the readline history file.
Test procedure:
```
$ ./prosodyctl shell
prosody> s2s:show() -- any command that is not the last in history
... output
prosody> bye
$ ./prosodyctl shell
prosody> ^P
```
After this, the shell prompt should contain the last command from before
the "bye". Before this patch, recent history is gone most of the time.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 22 Jan 2023 14:42:07 +0100 |
parents | 12859:cd738fb8c754 |
children | 12863:891edd1ebde6 |
files | util/prosodyctl/shell.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/prosodyctl/shell.lua Sat Jan 21 17:14:55 2023 +0100 +++ b/util/prosodyctl/shell.lua Sun Jan 22 14:42:07 2023 +0100 @@ -39,7 +39,7 @@ if have_readline then readline.save_history(); end - os.exit(); + os.exit(0, true); end send_line(client, line); end @@ -112,7 +112,7 @@ client.events.add_handler("disconnected", function () print("--- session closed ---"); - os.exit(); + os.exit(0, true); end); client.events.add_handler("received", function (stanza)