lib/spoom/cli/helper.rb in spoom-1.1.5 vs lib/spoom/cli/helper.rb in spoom-1.1.6
- old
+ new
@@ -81,10 +81,24 @@
sig { returns(Sorbet::Config) }
def sorbet_config
Sorbet::Config.parse_file(sorbet_config_file)
end
+ sig { params(exit_code: Integer, block: T.nilable(T.proc.void)).void }
+ def check_sorbet_segfault(exit_code, &block)
+ return unless exit_code == Spoom::Sorbet::SEGFAULT_CODE
+
+ say_error(<<~ERR, status: nil)
+ #{red("!!! Sorbet exited with code #{exit_code} - SEGFAULT !!!")}
+
+ This is most likely related to a bug in Sorbet.
+ ERR
+
+ block&.call
+ exit(exit_code)
+ end
+
# Colors
# Color used to highlight expressions in backticks
HIGHLIGHT_COLOR = T.let(Spoom::Color::BLUE, Spoom::Color)
@@ -125,9 +139,14 @@
end
sig { params(string: String).returns(String) }
def blue(string)
colorize(string, Color::BLUE)
+ end
+
+ sig { params(string: String).returns(String) }
+ def cyan(string)
+ colorize(string, Color::CYAN)
end
sig { params(string: String).returns(String) }
def gray(string)
colorize(string, Color::LIGHT_BLACK)