Class: Sevgi::Test::Shell::Runner Private
- Inherits:
-
Object
- Object
- Sevgi::Test::Shell::Runner
- Defined in:
- lib/sevgi/showcase/minitest/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.
Adapted to popen3 from github.com/mina-deploy/mina Shell command runner.
Instance Method Summary collapse
-
#initialize ⇒ void
constructor
private
Creates a runner.
-
#run(*args) { ... } ⇒ Sevgi::Test::Shell::Result
private
Runs a command and captures stdout, stderr, and exit status.
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 runner.
49 50 51 |
# File 'lib/sevgi/showcase/minitest/shell.rb', line 49 def initialize @coathooks = 0 end |
Instance Method Details
#run(*args) { ... } ⇒ Sevgi::Test::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.
The first SIGINT sends TERM and the second sends KILL outside trap context. The handler is restored after the last active run.
Runs a command and captures stdout, stderr, and exit status.
61 62 63 64 65 66 67 68 |
# File 'lib/sevgi/showcase/minitest/shell.rb', line 61 def run(*args, &block) @coathooks = 0 out, err, status = Open3.popen3(*args) do |stdin, stdout, stderr, thread| capture(stdin, stdout, stderr, thread, &block) end Result[args, out, err, status.exitstatus] end |