Sha256: 1ea2007fe4d068b056b3d12171a50012de31f8ce6fc0e759cb0764ae965f406c

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

require_relative 'cmd/version'
require 'logger'

module Tlopo
  LOGGER ||= Logger.new $stderr
  module CMD
    module_function

    def run(cmd, live = false)
      LOGGER.debug "Running CMD: [ #{cmd} ]"
      Process.wait(fork { exec cmd }) if live
      `#{cmd}` unless live
    end

    def run_or_die(cmd, live = false)
      out = run cmd, live
      raise "Failed to run '#{cmd}'" unless $?.success?

      out
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tlopo-cmd-0.1.0 lib/tlopo/cmd.rb