|
That Terminal
A terminal emulator designed for video making purposes.
|
#include <forkpty.hh>
Public Member Functions | |
| ForkPTY (std::size_t width, std::size_t height) | |
| ~ForkPTY () | |
| void | Open (std::size_t width, std::size_t height) |
| void | Close () |
| bool | Active () const |
| int | getfd () const |
| int | Send (std::string_view buffer) |
| std::pair< std::string, int > | Recv () |
| void | Kill (int signal) |
| void | Resize (unsigned xsize, unsigned ysize) |
ForkPTY is a communications end point between the terminal emulator and the underlying operating system. As the name suggests, it is a wrapper over the forkpty() call. It launches a shell in the host system.
|
inline |
| ForkPTY::~ForkPTY | ( | ) |
Destructor. Terminates the subprocess if it is still active.
| bool ForkPTY::Active | ( | ) | const |
| void ForkPTY::Close | ( | ) |
Terminate the subprocess.
| int ForkPTY::getfd | ( | ) | const |
| void ForkPTY::Kill | ( | int | signal | ) |
Send a signal to the subprocess.
| void ForkPTY::Open | ( | std::size_t | width, |
| std::size_t | height | ||
| ) |
Create a subprocess in a virtual terminal with given dimensions. If the opening is successful, the file descriptor is set to non-blocking mode.
| std::pair< std::string, int > ForkPTY::Recv | ( | ) |
Try to receive output from the subprocess in non-blcoking mode.
| void ForkPTY::Resize | ( | unsigned | xsize, |
| unsigned | ysize | ||
| ) |
Inform the subprocess (or its virtual terminal) that the terminal has been resized to the given dimensions.
| int ForkPTY::Send | ( | std::string_view | buffer | ) |
Try to send the string as input to the subprocess in non-blocking mode. This function is typically called when the user types something.
| buffer | The string to send to the subprocess; typically whatever the user typed. |