Module: FeduxOrgStdlib::Command::RunCommand
- Includes:
- Environment
- Included in:
- FeduxOrgStdlib::Command
- Defined in:
- lib/fedux_org_stdlib/command/run_command.rb
Overview
Run command
Instance Method Summary collapse
-
#run_command(cmd, options = {}) ⇒ CommandResult
Execute command.
Methods included from Environment
Instance Method Details
#run_command(cmd, options = {}) ⇒ CommandResult
Execute command
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fedux_org_stdlib/command/run_command.rb', line 36 def run_command(cmd, = {}) opts = { env: nil, stdin: nil, binmode: false, working_directory: Dir.getwd }.merge env = opts[:env] || ENV.to_hash stdin = opts[:stdin] binmode = opts[:binmode] working_directory = opts[:working_directory] result = CommandResult.new result.stdout, result.stderr, result.status = Open3.capture3(env, cmd, stdin_data: stdin, chdir: working_directory, binmode: binmode) result end |