Module: BobTheHelper::Command
- Includes:
- Environment
- Defined in:
- lib/bob_the_helper/command.rb,
lib/bob_the_helper/command/command_result.rb
Defined Under Namespace
Classes: CommandResult
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
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/bob_the_helper/command.rb', line 32 def run_command(cmd,={}) opts = { env: nil, stdin: nil, binmode: false, }.merge env = opts[:env] || ENV.to_hash stdin = opts[:stdin] binmode = opts[:binmode] result = CommandResult.new result.stdout, result.stderr, result.status = Open3.capture3(env, cmd, stdin_data: stdin, chdir: working_directory, binmode: binmode) result end |