Class: Sevgi::Test::Shell::Runner Private

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializevoid

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.



42
43
44
# File 'lib/sevgi/showcase/minitest/shell.rb', line 42

def initialize
  @coathooks = 0
end

Instance Method Details

#run(*args, &block) ⇒ 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.

Runs a command and captures stdout, stderr, and exit status.

Parameters:

  • args (Array<String>)

    command and arguments

Returns:



49
50
51
52
53
54
55
56
# File 'lib/sevgi/showcase/minitest/shell.rb', line 49

def run(*args, &block)
  out, err, status = Open3.popen3(*args) do |stdin, stdout, stderr, thread|
    inputs(stdin, thread, &block) if block
    outputs(stdout, stderr, thread)
  end

  Result[args, out, err, status.exitstatus]
end