Sha256: 4d21bb741cb7a91ad897f6cafffaeb919588dc1fbb69b417931987c2c7090c0e

Contents?: true

Size: 1.05 KB

Versions: 24

Compression:

Stored size: 1.05 KB

Contents

require "vagrant/util/busy"
require "vagrant/util/subprocess"

module VagrantPlugins
  module DockerProvider
    module Executor
      # The Local executor executes a Docker client that is running
      # locally.
      class Local
        def execute(*cmd, **opts, &block)
          # Append in the options for subprocess
          cmd << { notify: [:stdout, :stderr] }

          interrupted  = false
          int_callback = ->{ interrupted = true }
          result = ::Vagrant::Util::Busy.busy(int_callback) do
            ::Vagrant::Util::Subprocess.execute(*cmd, &block)
          end

          result.stderr.gsub!("\r\n", "\n")
          result.stdout.gsub!("\r\n", "\n")

          if result.exit_code != 0 && !interrupted
            raise Errors::ExecuteError,
              command: cmd.inspect,
              stderr: result.stderr,
              stdout: result.stdout
          end

          result.stdout
        end

        def windows?
          ::Vagrant::Util::Platform.windows? || ::Vagrant::Util::Platform.wsl?
        end
      end
    end
  end
end

Version data entries

24 entries across 20 versions & 3 rubygems

Version Path
vagrant-unbundled-2.2.6.2 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.6.1 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.6.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.5.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.4.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.3.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.2.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.2.0.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.1.4.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.1.2.0 plugins/providers/docker/executor/local.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/executor/local.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/executor/local.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/executor/local.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/executor/local.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/executor/local.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.1.1.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.0.4.0 plugins/providers/docker/executor/local.rb
vagrant-unbundled-2.0.3.0 plugins/providers/docker/executor/local.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/providers/docker/executor/local.rb