Class: Specinfra::Command::Base::Port

Inherits:
Specinfra::Command::Base show all
Defined in:
lib/specinfra/command/base/port.rb

Class Method Summary collapse

Methods inherited from Specinfra::Command::Base

create, escape

Class Method Details

.check_is_listening(port, options = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/specinfra/command/base/port.rb', line 3

def check_is_listening(port, options={})
  pattern = ":#{port} "
  pattern = " #{options[:local_address]}#{pattern}" if options[:local_address]
  pattern = "^#{options[:protocol]} .*#{pattern}" if options[:protocol]
  "netstat -tunl | grep -- #{escape(pattern)}"
end