Sha256: 3f9eacecea29afee55fca4dba76c40da9d96683f5840673651b73d1767fa8dde

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

require_relative 'backticks/version'
require_relative 'backticks/cli'
require_relative 'backticks/command'
require_relative 'backticks/runner'
require_relative 'backticks/ext'

module Backticks
  # Run a command; return a Command object that can be used to interact with
  # the running process.
  #
  # @param [String] cmd
  # @return [Backticks::Command] a running command
  def self.new(cmd)
    Backticks::Runner.new.command(cmd)
  end

  # Run a command; return its stdout.
  #
  # @param [String] cmd
  # @return [String] the command's output
  def self.run(cmd)
    command = self.new(*cmd)
    command.join
    command.captured_output
  end

  # Run a command; return its success or failure.
  #
  # @param [String] cmd
  # @return [Boolean] true if the command succeeded; false otherwise
  def self.system(*cmd)
    command = self.new(*cmd)
    command.join
    $?.success?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backticks-0.3.1 lib/backticks.rb