Sha256: 01ecdb219907e435e41606eb359224f9d1c090c909e570658a7e99fd3beda148

Contents?: true

Size: 751 Bytes

Versions: 75

Compression:

Stored size: 751 Bytes

Contents

module SpecInfra
  module Backend
    class WinRM < Base
      include PowerShell::ScriptHelper

      def run_command(cmd, opts={})
        script = create_script(cmd)
        winrm = SpecInfra.configuration.winrm

        result = winrm.powershell(script)
        stdout, stderr = [:stdout, :stderr].map do |s|
          result[:data].select {|item| item.key? s}.map {|item| item[s]}.join
        end
        result[:exitcode] = 1 if result[:exitcode] == 0 and !stderr.empty?

        if @example
          @example.metadata[:command] = script
          @example.metadata[:stdout]  = stdout + stderr
        end

        CommandResult.new :stdout => stdout, :stderr => stderr,
          :exit_status => result[:exitcode]
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
specinfra-1.27.5 lib/specinfra/backend/winrm.rb
specinfra-1.27.4 lib/specinfra/backend/winrm.rb
specinfra-1.27.3 lib/specinfra/backend/winrm.rb
specinfra-1.27.2 lib/specinfra/backend/winrm.rb
specinfra-1.27.1 lib/specinfra/backend/winrm.rb
specinfra-1.27.0 lib/specinfra/backend/winrm.rb
specinfra-1.26.0 lib/specinfra/backend/winrm.rb
specinfra-1.25.8 lib/specinfra/backend/winrm.rb
specinfra-1.25.7 lib/specinfra/backend/winrm.rb
specinfra-1.25.6 lib/specinfra/backend/winrm.rb
specinfra-1.25.5 lib/specinfra/backend/winrm.rb
specinfra-1.25.4 lib/specinfra/backend/winrm.rb
specinfra-1.25.3 lib/specinfra/backend/winrm.rb
specinfra-1.25.2 lib/specinfra/backend/winrm.rb
specinfra-1.25.1 lib/specinfra/backend/winrm.rb
specinfra-1.25.0 lib/specinfra/backend/winrm.rb
specinfra-1.24.0 lib/specinfra/backend/winrm.rb
specinfra-1.23.1 lib/specinfra/backend/winrm.rb
specinfra-1.23.0 lib/specinfra/backend/winrm.rb
specinfra-1.22.1 lib/specinfra/backend/winrm.rb