Class: Sapristi::NewProcessWindowDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/sapristi/new_process_window_detector.rb

Instance Method Summary collapse

Constructor Details

#initializeNewProcessWindowDetector

Returns a new instance of NewProcessWindowDetector.



5
6
7
8
# File 'lib/sapristi/new_process_window_detector.rb', line 5

def initialize
  @display = OSFactory.new.window_manager
  @process_manager = OSFactory.new.process_manager
end

Instance Method Details

#detect_window_for_process(command, timeout_in_seconds = 30) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sapristi/new_process_window_detector.rb', line 10

def detect_window_for_process(command, timeout_in_seconds = 30)
  save_pids_and_windows

  process_window = wait_for_window(command, timeout_in_seconds)

  if process_window
    ::Sapristi.logger.info "  Found window title=#{process_window.title} for process=#{process_window.pid}!"
  end

  process_window
end