From 3548d5995a92a358e0662934e33c3825681ad0c0 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 30 Sep 2023 01:33:59 +0400 Subject: [PATCH] Add some debugging --- exe/referator | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/exe/referator b/exe/referator index f309a34..6c037c9 100755 --- a/exe/referator +++ b/exe/referator @@ -12,7 +12,7 @@ $stdout.sync = true def parse_command(line) line = String(line).chomp - command = line[0...line.index(' ')].freeze + command = line[0...line.index(' ')].upcase.freeze rest = line[command.length..].strip.freeze [command, rest].freeze end @@ -31,6 +31,7 @@ workdir = File.expand_path(workdir).freeze config = Referator::Config.new workdir footnotes = Referator::Footnotes.new config +stacktrace = nil while (line = $stdin.gets) begin @@ -39,6 +40,11 @@ while (line = $stdin.gets) when 'EXIT' success exit + when 'PING' + success :pong + when 'STACKTRACE' + success stacktrace + stacktrace = nil when 'REGISTER_FORMAT' data = JSON.parse rest config.formats.register( @@ -76,6 +82,7 @@ while (line = $stdin.gets) raise 'Invalid command' end rescue => e + stacktrace = e.backtrace.map(&:freeze).freeze failure e.detailed_message end end