Working with PTY sessions for background and interactive processes
72
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillValidation for skill structure
Use pty_spawn instead of bash when:
| Action | Data |
|---|---|
| Ctrl+C (interrupt) | \x03 |
| Ctrl+D (EOF) | \x04 |
| Ctrl+Z (suspend) | \x1a |
| Enter | \n |
Send with pty_write: data="\x03"
Use the pattern parameter in pty_read to filter lines by regex:
pattern="error|ERROR" # find errors
pattern="ERROR|WARN|FATAL" # find warnings and errors
pattern="failed.*connection" # more specific matchpattern filters first, then offset/limit apply to the matches — original line numbers are preserved.
pty_list — see all running/exited sessionspty_read with high offset or omit offset to see latest outputoffset = totalLines - Npty_kill with cleanup=false (default) — stops process, keeps buffer for readingpty_kill with cleanup=true — stops process and frees buffer entirelySet notifyOnExit=true to receive a message when the process exits, including exit code and last output line. Useful for build processes where you want to be notified on completion rather than polling.
31daf20
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.