Skip to content

Commit 8fc631c

Browse files
committed
factor gui guessing into its own function
1 parent 110daa1 commit 8fc631c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/arduino_ci/arduino_cmd.rb

+11
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ def prefs
5656
def run(*args, **kwargs)
5757
full_args = [@installation.cmd_path] + args
5858
@display_mgr.run(*full_args, **kwargs)
59+
end
5960

61+
def run_with_gui_guess(message, *args, **kwargs)
62+
# On Travis CI, we get an error message in the GUI instead of on STDERR
63+
# so, assume that if we don't get a rapid reply that things are not installed
64+
x3 = @prefs_response_time * 3
65+
Timeout.timeout(x3) do
66+
run(*args, **kwargs)
67+
end
68+
rescue Timeout::Error
69+
puts "No response in #{x3} seconds. Assuming graphical modal error message#{message}."
70+
false
6071
end
6172

6273
# run a command and capture its output

0 commit comments

Comments
 (0)