1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

HackStudio: Separate master & slave PTY setup in TerminalWrapper

Previously the setup for both the master and slave pseudoterminals was
done in TerminalWrapper::run_command.

This commit separates the relevant logic into
TerminalWrapper::setup_master_pseudoterminal
and TerminalWrapper::setup_slave_pseudoterminal.
This commit is contained in:
Itamar 2021-12-20 22:32:21 +02:00 committed by Brian Gianforcaro
parent 83dd1e5b80
commit 0cea8d1310
2 changed files with 110 additions and 87 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/Error.h>
#include <LibGUI/Widget.h>
#include <LibVT/TerminalWidget.h>
@ -23,6 +24,13 @@ public:
bool user_spawned() const { return m_user_spawned; }
VT::TerminalWidget& terminal() { return *m_terminal_widget; }
enum class WaitForChildOnExit {
No,
Yes,
};
ErrorOr<int> setup_master_pseudoterminal(WaitForChildOnExit = WaitForChildOnExit::Yes);
static ErrorOr<void> setup_slave_pseudoterminal(int master_fd);
Function<void()> on_command_exit;
private: