terminal: Use proper lambda functions when registering a fd listener for the pseudoterminal
This commit is contained in:
parent
1cd355a8e8
commit
63f785563d
@ -35,8 +35,6 @@ static void sigchld_handler(int)
|
|||||||
ui::App::the().set_should_close(true);
|
ui::App::the().set_should_close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TerminalWidget* s_main = nullptr;
|
|
||||||
|
|
||||||
Result<void> TerminalWidget::init(char* const* args)
|
Result<void> TerminalWidget::init(char* const* args)
|
||||||
{
|
{
|
||||||
m_font = ui::Font::default_font();
|
m_font = ui::Font::default_font();
|
||||||
@ -62,17 +60,10 @@ Result<void> TerminalWidget::init(char* const* args)
|
|||||||
|
|
||||||
fcntl(m_pty, F_SETFL, O_NONBLOCK);
|
fcntl(m_pty, F_SETFL, O_NONBLOCK);
|
||||||
|
|
||||||
// FIXME: Find a better solution for this. What if the caller needs several TerminalWidgets in one app? We can't
|
os::EventLoop::the().register_fd_listener(m_pty, [this](int, int) { this->process(); });
|
||||||
// just use a singleton, can we?
|
|
||||||
os::EventLoop::the().register_fd_listener(m_pty, [](int, int) {
|
|
||||||
check(s_main);
|
|
||||||
s_main->process();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_child_pid = child;
|
m_child_pid = child;
|
||||||
|
|
||||||
s_main = this;
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user