Skip to content

Commit de410aa

Browse files
committed
Debug
1 parent d5ad99f commit de410aa

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

lib/benchmark_runner.rb

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -79,40 +79,39 @@ def render_graph(json_path)
7979
end
8080

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

8587
result = {}
8688

87-
if quiet
88-
result[:success] = system(env, command, out: File::NULL, err: File::NULL)
89-
result[:stderr] = ""
90-
else
91-
# Capture stderr while still showing stdout
92-
require 'open3'
89+
# Always use Open3 for debugging
90+
require 'open3'
91+
STDOUT.puts("[check_call] about to run Open3.capture3...")
92+
STDOUT.flush
93+
begin
9394
stdout_str, stderr_str, status = Open3.capture3(env, command)
94-
print stdout_str
95-
result[:success] = status.success?
96-
result[:status] = status
97-
result[:stderr] = stderr_str
98-
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-
104-
if raise_error && !result[:success]
105-
raise RuntimeError.new
106-
end
107-
108-
return result
95+
STDOUT.puts("[check_call] Open3.capture3 completed")
96+
rescue => e
97+
STDOUT.puts("[check_call] Open3.capture3 raised: #{e.class}: #{e.message}")
98+
STDOUT.puts(e.backtrace.first(5).join("\n"))
99+
raise
109100
end
110101

111-
result[:status] = $?
102+
STDOUT.puts("[check_call] stdout (#{stdout_str.bytesize} bytes):")
103+
STDOUT.print stdout_str
104+
STDOUT.puts("[check_call] stderr (#{stderr_str.bytesize} bytes):")
105+
STDOUT.print stderr_str
106+
STDOUT.puts("[check_call] exit status: #{status.exitstatus}")
107+
STDOUT.flush
108+
109+
result[:success] = status.success?
110+
result[:status] = status
111+
result[:stderr] = stderr_str
112112

113-
unless result[:success]
114-
puts "Command #{command.inspect} failed with exit code #{result[:status].exitstatus} in directory #{Dir.pwd}" unless quiet
115-
raise RuntimeError.new if raise_error
113+
if raise_error && !result[:success]
114+
raise RuntimeError.new
116115
end
117116

118117
result

0 commit comments

Comments
 (0)