-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Suppose I invoke Headless.run(display: pick-a-display(), autopick: true) do ... end, so that I specify both an initial guess for a display, and ask Headless to handle the rest. My server, for whatever the reason, currently has a particular display that consistently responds with "Cannot establish any listening sockets". (I don't know why; there are no Xvfb processes running at all. But that's beside the point right now...) So if pick-a-display() happens to hit that bad number, then this call to Headless.run will always fail, even though I've asked Headless to autopick a working display.
It seems to me that ensure_xvfb_launched is overly aggressive about terminating the call to :run. It would be nice for pick_available_display do something like
def pick_available_display(display_set, can_reuse)
@pending_exception = nil
display_set.each do |display_number|
@display = display_number
return true if xvfb_running? && can_reuse && (xvfb_mine? || !@autopick_display)
begin
return true if !xvfb_running? && launch_xvfb
rescue Headless::Exception => e
@pending_Exception = e
end
end
raise @pending_exception || Headless::Exception.new("Could not find an available display")
end
so that if other display options were available, the call would still succeed...