Sha256: 08c283ca31421576cc34f96218b9d288f5223837d6261508e6567a82ddba9fc4

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 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. Method parameters are passed through to the Runner.
  #
  # @see Backticks::Runner#command
  # @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.0 lib/backticks.rb