Sha256: 34481ce719a06323a6d4ea6596162bc19cedea4a9bf33ca5e0d34c5b2b45eb6c

Contents?: true

Size: 616 Bytes

Versions: 4

Compression:

Stored size: 616 Bytes

Contents

module RunShell

  # Runs a shell command and pipes output to console.
  def runshell(cmd, ignoreerrors=false)
    puts "+ #{cmd}"
    IO.popen("#{cmd} 2>&1", 'r') do |output|
      output.sync = true
      done = false
      while !done
        begin
          puts output.readline
        rescue EOFError
          done = true
        end
      end
    end

    exitstatus = $?.exitstatus
    fail "SHELL COMMAND FAILED - exit code #{exitstatus}" unless (ignoreerrors || $?.success?)
    return exitstatus
  end

  # for Windows-specific tasks.
  def is_windows?
    return !!(RUBY_PLATFORM =~ /mswin/)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
right_link-5.9.5 lib/run_shell.rb
right_link-5.9.2 lib/run_shell.rb
right_link-5.9.1 lib/run_shell.rb
right_link-5.9.0 lib/run_shell.rb