Sha256: cbb11cca2a33dcd3fbeb4f3d7fb6760b21b964cf6296d23c10f65c4b70eadf32

Contents?: true

Size: 600 Bytes

Versions: 70

Compression:

Stored size: 600 Bytes

Contents

require 'open3'

module Gitlab
  module Git
    module Popen
      def popen(cmd, path)
        unless cmd.is_a?(Array)
          raise "System commands must be given as an array of strings"
        end

        vars = { "PWD" => path }
        options = { chdir: path }

        @cmd_output = ""
        @cmd_status = 0
        Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
          @cmd_output << stdout.read
          @cmd_output << stderr.read
          @cmd_status = wait_thr.value.exitstatus
        end

        [@cmd_output, @cmd_status]
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
gitlab_git-10.7.0 lib/gitlab_git/popen.rb
gitlab_git-10.6.8 lib/gitlab_git/popen.rb
gitlab_git-10.6.7 lib/gitlab_git/popen.rb
gitlab_git-10.6.6 lib/gitlab_git/popen.rb
gitlab_git-10.6.5 lib/gitlab_git/popen.rb
gitlab_git-10.6.4 lib/gitlab_git/popen.rb
gitlab_git-10.6.3 lib/gitlab_git/popen.rb
gitlab_git-10.6.2 lib/gitlab_git/popen.rb
gitlab_git-10.6.1 lib/gitlab_git/popen.rb
gitlab_git-10.6.0 lib/gitlab_git/popen.rb
gitlab_git-10.5.0 lib/gitlab_git/popen.rb
gitlab_git-10.4.7 lib/gitlab_git/popen.rb
gitlab_git-10.4.6 lib/gitlab_git/popen.rb
gitlab_git-10.4.5 lib/gitlab_git/popen.rb
gitlab_git-10.4.4 lib/gitlab_git/popen.rb
gitlab_git-10.4.3 lib/gitlab_git/popen.rb
gitlab_git-10.4.2 lib/gitlab_git/popen.rb
gitlab_git-10.4.1 lib/gitlab_git/popen.rb
gitlab_git-10.4.0 lib/gitlab_git/popen.rb
gitlab_git-10.3.2 lib/gitlab_git/popen.rb