Sha256: 8b76b0f350dac4a8180220daa1a8ebae9ef45e692e4039fb063f254d8177bcfe

Contents?: true

Size: 605 Bytes

Versions: 9

Compression:

Stored size: 605 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

        return @cmd_output, @cmd_status
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gitlab_git-7.1.8 lib/gitlab_git/popen.rb
gitlab_git-7.1.7 lib/gitlab_git/popen.rb
gitlab_git-7.1.6 lib/gitlab_git/popen.rb
gitlab_git-7.1.5 lib/gitlab_git/popen.rb
gitlab_git-7.1.4 lib/gitlab_git/popen.rb
gitlab_git-7.1.3 lib/gitlab_git/popen.rb
gitlab_git-7.1.2 lib/gitlab_git/popen.rb
gitlab_git-7.1.1 lib/gitlab_git/popen.rb
gitlab_git-7.1.0 lib/gitlab_git/popen.rb