Sha256: 01ed9a7f065304d21475cacf7ed69abfbb4fc72c91a5f101bd9592f8c78b04ce

Contents?: true

Size: 832 Bytes

Versions: 7

Compression:

Stored size: 832 Bytes

Contents

module Windows::Exec
  include Beaker::CommandFactory

  def reboot
    exec(Beaker::Command.new('shutdown /r /t 0 /d p:4:1 /c "Beaker::Host reboot command issued"'), :expect_connection_failure => true)
  end

  ABS_CMD = 'c:\\\\windows\\\\system32\\\\cmd.exe'
  CMD = 'cmd.exe'

  def echo(msg, abs=true)
    (abs ? ABS_CMD : CMD) + " /c echo #{msg}"
  end

  def touch(file, abs=true)
    (abs ? ABS_CMD : CMD) + " /c echo. 2> #{file}"
  end

  def path
    'c:/windows/system32;c:/windows'
  end

  def get_ip
    ip = execute("ipconfig | grep -i 'IP Address' | cut -d: -f2 | head -1").strip
    if ip == ''
      ip = execute("ipconfig | grep -i 'IPv4 Address' | cut -d: -f2 | head -1").strip
    end
    if ip == ''
      ip = execute("ipconfig | grep -i 'IPv6 Address' | cut -d: -f2 | head -1").strip
    end
    ip
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
beaker-2.15.1 lib/beaker/host/windows/exec.rb
beaker-2.15.0 lib/beaker/host/windows/exec.rb
beaker-2.14.1 lib/beaker/host/windows/exec.rb
beaker-2.14.0 lib/beaker/host/windows/exec.rb
beaker-2.13.0 lib/beaker/host/windows/exec.rb
beaker-2.12.0 lib/beaker/host/windows/exec.rb
beaker-2.11.0 lib/beaker/host/windows/exec.rb