TuiProcess¶
struct TuiProcess
Manages the forgeview child process lifecycle.
Spawns forgeview via fork/exec, redirects parent's stderr to a pipe feeding forgeview's stdin. forgeview renders TUI on stdout (the terminal).
Variables¶
| Name | Description |
|---|---|
| child_pid | PID of the forgeview child process, or -1 if not spawned. |
| pipe_write_fd | Write end of the pipe feeding forgeview's stdin (equals STDERR_FILENO after redirect). |
| original_stderr_fd | Saved original stderr fd so it can be restored after forgeview exits. |
| active | True while forgeview is running and stderr is redirected to it. |
Functions¶
| Name | Description |
|---|---|
| spawn | Spawn forgeview and redirect stderr to it. |
| check_alive | Non-blocking check whether forgeview is still running. |
| wait | Close the pipe and wait for forgeview to exit. |
| instance | Access the singleton TuiProcess. |
Variable Details¶
active¶
bool active
True while forgeview is running and stderr is redirected to it.
child_pid¶
pid_t child_pid
PID of the forgeview child process, or -1 if not spawned.
original_stderr_fd¶
int original_stderr_fd
Saved original stderr fd so it can be restored after forgeview exits.
pipe_write_fd¶
int pipe_write_fd
Write end of the pipe feeding forgeview's stdin (equals STDERR_FILENO after redirect).
Function Details¶
check_alive¶
bool check_alive()
Non-blocking check whether forgeview is still running.
If forgeview has exited, restores the original stderr fd and marks this process as inactive. Returns true if forgeview is still alive.
instance¶
static TuiProcess& instance()
Access the singleton TuiProcess.
spawn¶
bool spawn(const std::string& forgeview_path)
Spawn forgeview and redirect stderr to it.
Return : true on success, false if forgeview not found or fork fails.
wait¶
void wait()
Close the pipe and wait for forgeview to exit.