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) { ... } ⇒ 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

Yields:

  • optional stdin writer evaluated with stdin as receiver

Yield Returns:

  • (Object)

Returns:

Raises:

  • (StandardError)

    when the input block raises; the child is terminated and reaped before propagation



52
53
54
55
56
57
58
# File 'lib/sevgi/showcase/minitest/shell.rb', line 52

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