Add some debugging
This commit is contained in:
parent
19beb1901a
commit
3548d5995a
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue