Some programs — interactive shells, pagers, text editors, and full-screen TUI applications — require a pseudo-terminal (TTY) to behave correctly. Without one, they may buffer output differently, disable colour rendering, or refuse to start at all. The Sprites Go SDK lets you attach a TTY to anyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/superfly/sprites-go/llms.txt
Use this file to discover all available pages before exploring further.
Cmd with a single method call before you start the process.
Enabling TTY mode
Callcmd.SetTTY(true) before cmd.Start() to request a pseudo-terminal for the remote process. The method panics if called after the process has already started.
Setting terminal dimensions
By default the remote TTY uses the server’s default size. Pass explicit dimensions withcmd.SetTTYSize(rows, cols).
Before Start — set the initial size
Call SetTTYSize before Start to negotiate the terminal size at launch time. SetTTYSize returns an error if TTY mode is not enabled.
After Start — resize a running terminal
Call SetTTYSize again on a running command to send a resize event to the remote process. This is how you respond to the local terminal window being resized.
SetTTYSize works both before and after Start. It is the preferred way to control terminal dimensions in new code.cmd.Resize (deprecated)
Resize is an older method that only works after Start and was superseded by SetTTYSize. It is kept for compatibility but new code should use SetTTYSize instead.
When to use TTY mode
TTY mode is needed whenever the remote program checks whether its standard streams are connected to a terminal:- Interactive shells (
bash,sh,zsh) - Pagers (
less,more) - Text editors (
vi,vim,nano) - Full-screen TUI applications (
htop,ncdu, custom curses apps) - Programs that use terminal escape codes for colour or cursor control
echo, ls, grep, or cat do not need TTY mode and will work fine without it.
Running bash interactively
The example below attaches the local process’s stdin and stdout to a remotebash session, giving the user a fully interactive shell.
Using context with TTY commands
TTY mode works withCommandContext. If the context is cancelled — for example, because the user pressed a cancel button in a UI — the remote process is killed.
Sending signals to interactive processes
With TTY mode enabled you can still usecmd.Signal to deliver signals to the remote process — useful when you need to interrupt or terminate a long-running interactive command programmatically rather than waiting for user input.
INT, TERM, HUP, KILL, QUIT, USR1, USR2.