Class: Sevgi::Function::Shell::Runner Private
- Inherits:
-
Object
- Object
- Sevgi::Function::Shell::Runner
- Defined in:
- lib/sevgi/function/shell.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Runs shell commands and captures stdout, stderr, and exit status.
Instance Method Summary collapse
-
#call(*args) { ... } ⇒ Sevgi::Function::Shell::Result
private
Runs a command and captures its output.
-
#initialize ⇒ void
constructor
private
Creates a shell runner.
Constructor Details
#initialize ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a shell runner.
81 82 83 |
# File 'lib/sevgi/function/shell.rb', line 81 def initialize @coathooks = 0 end |
Instance Method Details
#call(*args) { ... } ⇒ Sevgi::Function::Shell::Result
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs a command and captures its output.
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/sevgi/function/shell.rb', line 91 def call(*args, &input) return Result.dummy if args.empty? outs, errs, status = Open3.popen3(*args) do |stdin, stdout, stderr, wait_thread| content = input.call if input stdin.write(content) if content stdin.close capture(stdout, stderr, wait_thread) end Result.new(args, outs, errs, status.exitstatus) end |