Understand the session lifecycle
mainSpawn
When you run pilotty spawn --name myapp my-command, the daemon:
- Creates a PTY.
- Forks the child process with the specified command.
- Initializes a terminal emulator (default size 80x24).
- Returns a session ID.
Active Use
During an active session, the screen buffer updates based on process output, the cursor position is tracked, and the terminal size can be modified using the resize command.
Process Exit
When the child process exits, the session is marked for cleanup. Cleanup typically occurs within 500ms, and the session is removed from the active list.
Manual Kill
Use pilotty kill -s <name> to manually terminate a session. This sends a SIGTERM to the child process and then performs cleanup.
pilotty kill -s myapp