Sha256: 43bd7b0c014a856fd70cd9710cdc2f7d0ae8f1e6cff3523a40ab8d01f151d50b

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

# typed: true
# frozen_string_literal: true

require "colorize"
require "sorbet-runtime"

module Spoom
  extend T::Sig

  SPOOM_PATH = (Pathname.new(__FILE__) / ".." / "..").to_s

  class Error < StandardError; end

  sig do
    params(
      cmd: String,
      arg: String,
      path: String,
      capture_err: T::Boolean
    ).returns([String, T::Boolean])
  end
  def self.exec(cmd, *arg, path: '.', capture_err: false)
    method = capture_err ? "popen2e" : "popen2"
    Open3.send(method, [cmd, *arg].join(" "), chdir: path) do |_, o, t|
      [o.read, T.cast(t.value, Process::Status).success?]
    end
  end
end

require "spoom/sorbet"
require "spoom/cli"
require "spoom/version"

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spoom-1.1.4 lib/spoom.rb
spoom-1.1.3 lib/spoom.rb
spoom-1.1.2 lib/spoom.rb
spoom-1.1.1 lib/spoom.rb
spoom-1.1.0 lib/spoom.rb
spoom-1.0.9 lib/spoom.rb