local client forks in destructor so that the kak server detaches from terminal
This commit is contained in:
parent
16b8f19db3
commit
acbe45e294
16
src/main.cc
16
src/main.cc
|
@ -602,7 +602,21 @@ void register_registers()
|
|||
void create_local_client(const String& file)
|
||||
{
|
||||
Buffer* buffer = nullptr;
|
||||
UserInterface* ui = new NCursesUI{};
|
||||
|
||||
class LocalNCursesUI : public NCursesUI
|
||||
{
|
||||
~LocalNCursesUI()
|
||||
{
|
||||
if (not ClientManager::instance().empty() and fork())
|
||||
{
|
||||
this->~NCursesUI();
|
||||
puts("detached from terminal\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
UserInterface* ui = new LocalNCursesUI{};
|
||||
if (not file.empty())
|
||||
{
|
||||
buffer = create_buffer_from_file(file);
|
||||
|
|
Loading…
Reference in New Issue
Block a user