TerminalLaunchConfig
TerminalLaunchConfig tells TerminalSession
how to start a local terminal program: which folder should it start in
which command-line arguments should it receive
which extra environment variables should be set before it starts
It is not a widget. It does not draw anything on screen by itself. Instead, it tells TerminalSession::spawn(...) how to create the terminal-side process that TerminalView can later render. Why this exists
An embedded terminal surface sits close to the host operating system.
When Fission starts a terminal session, it is not just rendering text. It is launching a real process and connecting it to a pseudo-terminal (PTY). A pseudo-terminal is an operating-system feature that makes a normal program think it is running inside a regular terminal window.
TerminalLaunchConfig is the typed way to describe how that process should start.
The configuration is a request to launch one local process. It is not a
portable subprocess API for Web or mobile, and it is not the process's retained
state after launch.
Example
use std::path::PathBuf;
use std::sync::Arc;
use fission::prelude::*;
// Host-side launch function; run through the app's native lifecycle/service,
// not directly on a synchronous UI reducer or during component conversion.
fn repository_status(repository: PathBuf) -> anyhow::Result<Arc<TerminalSession>> {
TerminalSession::spawn(TerminalLaunchConfig {
cwd: Some(repository),
program: Some("git".into()),
args: vec!["status".into(), "--short".into()],
env: Vec::new(),
})
}
The repository path comes from the user's current workspace. Argument values
are passed separately, not concatenated into a shell command; do not replace
this with sh -c around untrusted input. The caller owns launch failures and
the returned live handle. Enable terminal-widget on your fission dependency
for this API; terminal is the corresponding feature on the underlying
fission-widgets crate. It is unavailable on Web, Android, and iOS.
If you omit program, the implementation asks the host for the default shell or default terminal program instead.
Field reference
| | | Notes and default behavior |
|---|
| | The working directory for the new process. | Defaults to None, which means no explicit directory is requested and the host default is used. |
| | The program to launch inside the terminal session. | Defaults to None, which means the implementation asks for the default shell or default terminal program. |
| | Command-line arguments passed to program. | Defaults to an empty list. These are mainly useful when program names a specific command such as git or python. |
| | Extra environment variables to add before the process starts. | Defaults to an empty list. The runtime also sets TERM=xterm-256color and COLORTERM=truecolor for terminal behavior and color support. |
What belongs here and what does not
Put startup choices here.
That includes things like the initial folder, the program name, a fixed command to run, or extra environment variables the process needs at launch.
Do not treat this struct as long-lived terminal state. Once the terminal session is running, the session itself owns the live process, terminal buffer, selection, and scrollback history. TerminalLaunchConfig is only the startup description.
Specific guidance
Request terminal creation from an explicit application event, then perform
process startup in the application's native host lifecycle or service adapter.
Do not call TerminalSession::spawn(...) during component conversion or block
a synchronous UI reducer on it. A live Arc<TerminalSession> is not a
serializable job result; the native adapter must retain and expose the live
handle rather than pretending it can cross an ordinary serialized effect boundary.
If the user can choose the starting folder or program, keep those choices in app state and build the TerminalLaunchConfig from that state when it is time to launch the session.
Also remember that this is a host capability centered on local process execution. It is a strong fit for desktop-style products, but it is not the right starting point for browser-only work.