Sha256: a751606d2a35671ce4d2c354f935e48ef2bc970b15a3986fc195fd4ee30789c9

Contents?: true

Size: 592 Bytes

Versions: 28

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

require "open3"

module Jekyll
  module Utils
    module Exec
      extend self

      # Runs a program in a sub-shell.
      #
      # *args - a list of strings containing the program name and arguments
      #
      # Returns a Process::Status and a String of output in an array in
      # that order.
      def run(*args)
        stdin, stdout, stderr, process = Open3.popen3(*args)
        out = stdout.read.strip
        err = stderr.read.strip

        [stdin, stdout, stderr].each(&:close)
        [process.value, out + err]
      end

    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
jekyll-3.10.0 lib/jekyll/utils/exec.rb
jekyll-3.9.5 lib/jekyll/utils/exec.rb
jekyll-3.9.4 lib/jekyll/utils/exec.rb
jekyll-3.9.3 lib/jekyll/utils/exec.rb
jekyll-3.9.2 lib/jekyll/utils/exec.rb
jekyll-3.9.1 lib/jekyll/utils/exec.rb
jekyll-3.9.0 lib/jekyll/utils/exec.rb
jekyll-3.8.7 lib/jekyll/utils/exec.rb
jekyll-3.8.6 lib/jekyll/utils/exec.rb
jekyll-3.8.5 lib/jekyll/utils/exec.rb
jekyll-3.6.3 lib/jekyll/utils/exec.rb
jekyll-3.8.4 lib/jekyll/utils/exec.rb
jekyll-3.7.4 lib/jekyll/utils/exec.rb
jekyll-3.8.3 lib/jekyll/utils/exec.rb
jekyll-3.8.2 lib/jekyll/utils/exec.rb
jekyll-3.8.1 lib/jekyll/utils/exec.rb
jekyll-3.8.0 lib/jekyll/utils/exec.rb
jekyll-3.8.0.pre.rc2 lib/jekyll/utils/exec.rb
jekyll-3.8.0.pre.rc1 lib/jekyll/utils/exec.rb
jekyll-3.7.3 lib/jekyll/utils/exec.rb