Skip to content

Commit e56f200

Browse files
committed
Debug
1 parent d5ad99f commit e56f200

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

lib/benchmark_runner.rb

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ def render_graph(json_path)
8080

8181
# Checked system - error or return info if the command fails
8282
def check_call(command, env: {}, raise_error: true, quiet: ENV['BENCHMARK_QUIET'] == '1')
83-
puts("+ #{command}") unless quiet
83+
STDOUT.puts("[check_call] + #{command}")
84+
STDOUT.puts("[check_call] env: #{env.inspect}")
85+
STDOUT.flush
8486

8587
result = {}
8688

@@ -90,17 +92,28 @@ def check_call(command, env: {}, raise_error: true, quiet: ENV['BENCHMARK_QUIET'
9092
else
9193
# Capture stderr while still showing stdout
9294
require 'open3'
93-
stdout_str, stderr_str, status = Open3.capture3(env, command)
94-
print stdout_str
95+
STDOUT.puts("[check_call] about to run Open3.capture3...")
96+
STDOUT.flush
97+
begin
98+
stdout_str, stderr_str, status = Open3.capture3(env, command)
99+
STDOUT.puts("[check_call] Open3.capture3 completed")
100+
rescue => e
101+
STDOUT.puts("[check_call] Open3.capture3 raised: #{e.class}: #{e.message}")
102+
STDOUT.puts(e.backtrace.first(5).join("\n"))
103+
raise
104+
end
105+
106+
STDOUT.puts("[check_call] stdout (#{stdout_str.bytesize} bytes):")
107+
STDOUT.print stdout_str
108+
STDOUT.puts("[check_call] stderr (#{stderr_str.bytesize} bytes):")
109+
STDOUT.print stderr_str
110+
STDOUT.puts("[check_call] exit status: #{status.exitstatus}")
111+
STDOUT.flush
112+
95113
result[:success] = status.success?
96114
result[:status] = status
97115
result[:stderr] = stderr_str
98116

99-
unless result[:success]
100-
puts "Command #{command.inspect} failed with exit code #{status.exitstatus} in directory #{Dir.pwd}"
101-
STDERR.print stderr_str unless stderr_str.empty?
102-
end
103-
104117
if raise_error && !result[:success]
105118
raise RuntimeError.new
106119
end

0 commit comments

Comments
 (0)