LibLinEdit + Shell: handle signals

This allows the LineEditor to get notified about signals, since we
cannot set signal handlers in a clean way within the LineEditor
instance.
This commit is contained in:
AnotherTest 2020-03-30 21:55:09 +04:30 committed by Andreas Kling
commit 5062a7d4cd
Notes: sideshowbarker 2024-07-19 08:02:12 +09:00
3 changed files with 12 additions and 12 deletions

View file

@ -1154,14 +1154,16 @@ int main(int argc, char** argv)
signal(SIGINT, [](int) {
g.was_interrupted = true;
});
signal(SIGHUP, [](int) {
save_history();
editor.interrupted();
});
signal(SIGWINCH, [](int) {
g.was_resized = true;
editor.resized();
});
signal(SIGHUP, [](int) {
save_history();
});
int rc = gethostname(g.hostname, sizeof(g.hostname));