Class: SubshellCommand::StandardOutputStreamsExecutor
- Inherits:
-
Object
- Object
- SubshellCommand::StandardOutputStreamsExecutor
- 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) ⇒ StandardOutputStreamsExecutor
constructor
A new instance of StandardOutputStreamsExecutor.
Constructor Details
#initialize(command_object, result) ⇒ StandardOutputStreamsExecutor
Returns a new instance of StandardOutputStreamsExecutor.
62 63 64 65 |
# File 'lib/subshell_command.rb', line 62 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.
60 61 62 |
# File 'lib/subshell_command.rb', line 60 def command_object @command_object end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
60 61 62 |
# File 'lib/subshell_command.rb', line 60 def result @result end |
Instance Method Details
#execute ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/subshell_command.rb', line 67 def execute Open3.popen3( command_object.env_hash, command_object.command_string, chdir: command_object.current_directory, ) do |stdin, stdout, stderr, wait_thr| exit_status = wait_thr.value result.stdout_value = stdout.read result.stderr_value = stderr.read result.success = exit_status.success? end end |