Sha256: 0453a3df9aa77ab99c8bd8320eaf6a1c3a059d04293c93311c941ecbdd37856c

Contents?: true

Size: 758 Bytes

Versions: 23

Compression:

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

        { :stdout => stdout, :stderr => stderr,
          :exit_status => result[:exitcode], :exit_signal => nil }
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
specinfra-0.4.1 lib/specinfra/backend/winrm.rb
specinfra-0.4.0 lib/specinfra/backend/winrm.rb
specinfra-0.3.2 lib/specinfra/backend/winrm.rb
specinfra-0.3.1 lib/specinfra/backend/winrm.rb
specinfra-0.3.0 lib/specinfra/backend/winrm.rb
specinfra-0.2.1 lib/specinfra/backend/winrm.rb
specinfra-0.2.0 lib/specinfra/backend/winrm.rb
specinfra-0.1.1 lib/specinfra/backend/winrm.rb
specinfra-0.1.0 lib/specinfra/backend/winrm.rb
specinfra-0.0.17 lib/specinfra/backend/winrm.rb
specinfra-0.0.16 lib/specinfra/backend/winrm.rb
specinfra-0.0.15 lib/specinfra/backend/winrm.rb
specinfra-0.0.14 lib/specinfra/backend/winrm.rb
specinfra-0.0.13 lib/specinfra/backend/winrm.rb
specinfra-0.0.12 lib/specinfra/backend/winrm.rb
specinfra-0.0.11 lib/specinfra/backend/winrm.rb
specinfra-0.0.10 lib/specinfra/backend/winrm.rb
specinfra-0.0.9 lib/specinfra/backend/winrm.rb
specinfra-0.0.8 lib/specinfra/backend/winrm.rb
specinfra-0.0.7 lib/specinfra/backend/winrm.rb