Skip to content

lcmen/go-pty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  __ _  ___        _ __ | |_ _   _
 / _` |/ _ \ _____| '_ \| __| | | |
| (_| | (_) |_____| |_) | |_| |_| |
 \__, |\___/      | .__/ \__|\__, |
 |___/            |_|        |___/

A process manager that runs commands from a Procfile, each in its own pseudoterminal (PTY). Every process gets a real terminal, so you can attach to any running process and use interactive debuggers and REPLs directly, like binding.irb, byebug, breakpoint, etc.

Press ctrl+] to attach to a process and get a full interactive terminal session — type commands, inspect variables, step through code. Press ctrl+] again to detach and return to the combined output view.

Usage

go-pty                  # reads ./Procfile
go-pty -f FILE          # reads a specific Procfile
go-pty -s web,worker    # run only specific processes
go-pty -e .env          # load environment variables from file

Procfile format

_: bin/rails assets:precompile
_db: bin/rails db:migrate
web: bundle exec rails server -p 3000
worker: bundle exec sidekiq
css: tailwindcss --watch

Entries whose name starts with _ are treated as preflight commands.

  • They run sequentially in alphabetical order.
  • Every preflight command must exit with code 0.
  • If any preflight fails, go-pty exits and services are not started.
  • Preflights always run, even when using -s to select services.
  • Preflights are rerun on ctrl+r restarts.

Keep preflights short-lived. They are intended for setup checks and one-off preparation, not long-running watchers or interactive commands. During a ctrl+r restart, go-pty waits for preflights to finish before services are started again.

Environment file format

FOO=bar
BASE=/app
LOG=${BASE}/logs

Variables are expanded in order. Use ${VAR} syntax to reference previously defined variables or existing environment variables.

Keyboard shortcuts

Mode Key Action
Normal Enter Insert a blank line as a visual separator
Normal ctrl+] Open process selection dialog
Normal ctrl+c Shut down all processes and exit
Dialog Up/Down Navigate process list
Dialog Enter Attach to selected process
Dialog Esc Cancel
Attached ctrl+] Detach and return to normal mode

In normal mode, output from all processes is shown with colored prefixes. In attached mode, you get a raw terminal session with the selected process — full readline support, colors, and interactivity.

Building

make build
make test

License

MIT

About

Run multiple commands concurrently, each in its own pseudoterminal.

Resources

License

Stars

Watchers

Forks

Contributors