Module: TTY::Command::Window::Integration
- Included in:
- TTY::Command
- Defined in:
- lib/tty/command/window/integration.rb
Overview
Adds #run_windowed and #run_windowed! to TTY::Command.
Instance Method Summary collapse
-
#run_windowed(*args) {|chunk, nil| ... } ⇒ TTY::Command::Result
Run a command inside a live, fixed-height terminal window and raise
TTY::Command::ExitErroron failure (mirrorsTTY::Command#run). -
#run_windowed!(*args) ⇒ TTY::Command::Result
Same as #run_windowed but never raises on non-zero exit.
Instance Method Details
#run_windowed(*args) {|chunk, nil| ... } ⇒ TTY::Command::Result
Under windowed rendering the child runs in a PTY, so its
stderr is merged into Result#out at the OS level;
Result#err is always "" (compare the plain run, where
stderr is a separate stream). If you must inspect stderr
independently, use run / run! or set +on_unavailable:
:raise+ and handle both branches.
Run a command inside a live, fixed-height terminal window and raise
TTY::Command::ExitError on failure (mirrors TTY::Command#run).
The child runs in a PTY reporting lines: rows, so cursor-driven
programs lay themselves out for the window height. Output is
interpreted by a terminal emulator and painted as a static block.
When stdout is not a TTY (or on Windows, or without PTY support)
the call degrades to a plain run with full streamed output —
unless on_unavailable: :raise is set, in which case
Unavailable is raised instead.
59 60 61 |
# File 'lib/tty/command/window/integration.rb', line 59 def run_windowed(*args, &) execute_windowed(args, raise_on_error: true, &) end |
#run_windowed!(*args) ⇒ TTY::Command::Result
Same as #run_windowed but never raises on non-zero exit.
66 67 68 |
# File 'lib/tty/command/window/integration.rb', line 66 def run_windowed!(*args, &) execute_windowed(args, raise_on_error: false, &) end |