Launching an external process with ExecProcessMessage
Command.execProcess(process, outputHandler, errorHandler) pauses the TUI renderer, runs the external process with full terminal access, then resumes the TUI and dispatches an ExecCompletedMessage when the process exits.
This is the right choice for spawning interactive programs like text editors, pagers, or sub-shells.
Redirect stdin, stdout, and stderr to
INHERIT so the external process can read from and write to the real terminal. Without this the process won’t be able to render its own UI.Handling ExecCompletedMessage
When the process exits, TUI4J dispatches anExecCompletedMessage to your update() method. Inspect it to determine whether the process succeeded:
Complete example
Suspending the TUI
SuspendMessage sends the TUI process to the background (equivalent to Ctrl+Z in a shell). The terminal is restored to normal and the shell regains control. When the user brings the process back to the foreground (fg), TUI4J dispatches a ResumeMessage and redraws the interface.
Exec vs suspend
Mouse input
Handle clicks and motion in your TUI
Spring Boot integration
Embed TUI4J into a Spring Boot app