Skip to content

Commit 5b51c6e

Browse files
committed
fix(spec): surface simulator stderr (or the IO::Error) on failure
`Exception.new stderr.gets_to_end` produced a bare "Error:" message when the simulator died without writing to stderr. Reraise with the shell name and the original IO::Error so the failure has actionable detail instead of an empty string.
1 parent 45bb4a9 commit 5b51c6e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/tabular/shell.cr

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ module Tabular(T)
6666
end
6767

6868
buffer
69-
rescue IO::Error
70-
raise Exception.new stderr.gets_to_end
69+
rescue err : IO::Error
70+
# Surface anything the simulator wrote to stderr — and if it stayed
71+
# silent, fall back to the original IO::Error so the failure isn't
72+
# reported as a bare "Error:" with no detail.
73+
diag = stderr.gets_to_end rescue ""
74+
diag = "#{err.class}: #{err.message} (no stderr captured)" if diag.empty?
75+
raise Exception.new "[#{self} simulator] #{diag}"
7176
end
7277
end
7378

0 commit comments

Comments
 (0)