Class: SubshellCommand::CombinedOutputStreamsExecutor
- Inherits:
-
Object
- Object
- SubshellCommand::CombinedOutputStreamsExecutor
- Defined in:
- lib/subshell_command.rb
Instance Attribute Summary collapse
-
#command_object ⇒ Object
readonly
Returns the value of attribute command_object.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(command_object, result) ⇒ CombinedOutputStreamsExecutor
constructor
A new instance of CombinedOutputStreamsExecutor.
Constructor Details
#initialize(command_object, result) ⇒ CombinedOutputStreamsExecutor
Returns a new instance of CombinedOutputStreamsExecutor.
84 85 86 87 |
# File 'lib/subshell_command.rb', line 84 def initialize(command_object, result) @command_object = command_object @result = result end |
Instance Attribute Details
#command_object ⇒ Object (readonly)
Returns the value of attribute command_object.
82 83 84 |
# File 'lib/subshell_command.rb', line 82 def command_object @command_object end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
82 83 84 |
# File 'lib/subshell_command.rb', line 82 def result @result end |
Instance Method Details
#execute ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/subshell_command.rb', line 89 def execute Open3.popen2e( command_object.env_hash, command_object.command_string, chdir: command_object.current_directory, ) do |stdin, output_streams, wait_thr| exit_status = wait_thr.value output_value = output_streams.read result.stdout_value = output_value result.stderr_value = output_value result.success = exit_status.success? end end |