Module: RubyProgress::ShellExec

Defined in:
lib/ruby-progress/output_capture.rb

Overview

Shell execution helpers for spawning commands within a PTY

Class Method Summary collapse

Class Method Details

.build_shell_argv(shell, command) ⇒ Array<String>

Build argv for invoking the user’s shell with a command string. Uses login shells so aliases/functions and environment are available.

Parameters:

  • shell (String)

    path to shell executable

  • command (String)

    command to execute

Returns:

  • (Array<String>)

    argv (excluding the shell path for convenience)



26
27
28
29
30
31
32
33
34
# File 'lib/ruby-progress/output_capture.rb', line 26

def build_shell_argv(shell, command)
  shell_name = File.basename(shell)
  case shell_name
  when 'fish'
    ['-l', '-c', command]
  else
    ['-lc', command]
  end
end