summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2015-09-15 17:31:20 +0200
committeranonym <anonym@riseup.net>2015-09-15 17:31:20 +0200
commit43b65f0eccbfff08f53a6469c940bbeab3e36ee9 (patch)
treeb1091f4791a3376dcf7e475058f2e5b82d26a202
parentc78e6e2a82fb4ba4d898c2a5f4e38f526724cd66 (diff)
Bind Java's stdout to the pseudo fifo logger after its set up.
If we do it before (which would happen if sikuli_helper.rb is loaded by Ruby before hooks.rb) it may not be present or may contain stuff from a previous run that doesn't belong to this run.
-rw-r--r--features/support/helpers/sikuli_helper.rb8
-rw-r--r--features/support/hooks.rb2
2 files changed, 7 insertions, 3 deletions
diff --git a/features/support/helpers/sikuli_helper.rb b/features/support/helpers/sikuli_helper.rb
index 72e41eb..f83ec8d 100644
--- a/features/support/helpers/sikuli_helper.rb
+++ b/features/support/helpers/sikuli_helper.rb
@@ -43,9 +43,11 @@ end
# Bind Java's stdout to debug_log() via our magical pseudo fifo
# logger.
-file_output_stream = Java::Io::FileOutputStream.new(DEBUG_LOG_PSEUDO_FIFO)
-print_stream = Java::Io::PrintStream.new(file_output_stream)
-Java::Lang::System.setOut(print_stream)
+def bind_java_to_pseudo_fifo_logger
+ file_output_stream = Java::Io::FileOutputStream.new(DEBUG_LOG_PSEUDO_FIFO)
+ print_stream = Java::Io::PrintStream.new(file_output_stream)
+ Java::Lang::System.setOut(print_stream)
+end
def findfailed_hook(pic)
STDERR.puts ""
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
index 3517dc7..c72fd7a 100644
--- a/features/support/hooks.rb
+++ b/features/support/hooks.rb
@@ -42,6 +42,8 @@ AfterConfiguration do |config|
watcher.run
end
end
+ # Fix Sikuli's debug_log():ing.
+ bind_java_to_pseudo_fifo_logger
end
# For @product tests