<commit_before>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, &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

          if result.exit_code != 0 && !interrupted
            msg = result.stdout.gsub("\r\n", "\n")
            msg << result.stderr.gsub("\r\n", "\n")
            raise "#{cmd.inspect}\n#{msg}" #Errors::ExecuteError, :command => command.inspect
          end

          # Return the output, making sure to replace any Windows-style
          # newlines with Unix-style.
          result.stdout.gsub("\r\n", "\n")
        end
      end
    end
  end
end<commit_msg>providers/docker: raise better error for local executor<commit_after>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, &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: command.inspect,
              stderr: result.stderr,
              stdout: result.stdout
          end

          result.stdout
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10956937799043062, 'fraction_numerical': 0.0009569377990430622, 'mean_word_length': 2.0086330935251797, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4217978', 'n_tokens_mistral': 605, 'n_tokens_neox': 590, 'n_words': 157}