Bring a background task into a tab
Not every task needs a visible tab from the start. Run work in a hidden PTY, inspect its output, then bring the same process and history into a tab when needed.
Preparation
Open a Tasty window and run these commands in its terminal. If tasty cannot connect, check the CLI guide.
This is a PTY without a tab inside a running Tasty instance, separate from running Tasty itself with a GUI-free headless build on a server.
Input examples use Bash, Zsh, or Git Bash. Replace example PTY ID 2147483648 and Pane ID 1 with actual IDs from your instance.
1. Open a shell without a tab
tasty pty spawn
tasty pty list
Note the PTY ID in the creation response. It appears in the list without creating a visible tab. With no command supplied, the shell waits for input.
You can also give the starting folder and a first command.
tasty pty spawn --cwd ~/proj -- cargo test
--cwd sets the PTY’s working folder. Everything after -- runs right away in the PTY’s shell.
2. Send a command and read output
tasty pty write --id 2147483648 $'pwd\n'
tasty pty read --id 2147483648 --lines 20
By default read leaves out dimmed text (for example Claude Code’s autocomplete suggestions), so unsubmitted suggestions aren’t mistaken for real output. Add --show-dim to include it.
write sends characters as received. Bash-family $'...\n' includes an actual newline to submit the command; ordinary double quotes in "...\n" do not.
From PowerShell, use:
tasty pty write --id 2147483648 "pwd`n"
Check that output shows the working directory. Read again if output has not appeared yet. Run your own task the same way.
3. Check the process state
tasty pty state --id 2147483648
state returns the current exit state immediately; it does not block until exit. To wait, call it again. The older name pty wait is still accepted and behaves the same. While the shell is alive, exited is false. After exit, the response also includes its exit code and success flag.
A command finishing inside a shell does not mean the shell exited. Distinguish the PTY’s exit state from individual shell command results.
4. View the same task in a tab
tasty list panes
tasty pty attach-surface --pty 2147483648 --pane 1
Use a Pane ID from the list. Only a running PTY can be brought into a tab. A new background tab keeps its process and output history, and the old PTY ID leaves pty list.
If bringing it in fails, the process is not ended and returns to its original PTY ID. In the rare case it cannot return to that ID, you get the recovery-required error (-32068), and the process stays running outside pty list until Tasty exits.
Your view does not switch automatically. Select the tab when you want to inspect it. The response includes new tab and Surface IDs for subsequent CLI operations. Do not use the old PTY ID with pty read or pty kill.
5. Clean up
- For a PTY that is still hidden, run
tasty pty kill --id 2147483648with its actual ID. This terminates the process and removes it from the hidden PTY list. - After bringing it into a tab, close that tab when finished. It is no longer managed through the hidden PTY list.
There is no limit on the number of hidden PTYs, and exited PTYs that remain do not prevent new ones. To cap how many run at once, use a semaphore from task ordering.
Tasty does not end a running PTY just because nobody checked it for a while. It runs until you kill it. If you want it ended after a period without checks, pass --idle-timeout <seconds> when creating it. If no read, write, or state arrives within that time, Tasty ends the process and leaves a warning notification. Background output does not extend that time.
An exited PTY stays in the list so you can read its exit code. Five minutes after Tasty first confirms the exit during cleanup or after your last read, write, or state call, whichever is later, it is cleaned up and an info notification records the cleanup. Tasty checks for exited PTYs periodically, so it may first notice an exit up to 90 seconds after the process actually ended.
If something goes wrong
- If a PTY cannot be found, check
tasty pty list. It may have moved into a tab or been cleaned up. If Tasty cleaned it up, the error message tells you whether its idle timeout expired or it was an exited PTY being cleaned up, and a notification records it as well. - An exited PTY cannot be brought into a tab. Inspect its output and exit state, then clean it up.
- If input does not execute, check that you sent an actual newline.
For regular child terminals and output reading, see the CLI guide. For dependencies and failure handling, see task orchestration.