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)
|
def parse_command(line)
|
||||||
line = String(line).chomp
|
line = String(line).chomp
|
||||||
command = line[0...line.index(' ')].freeze
|
command = line[0...line.index(' ')].upcase.freeze
|
||||||
rest = line[command.length..].strip.freeze
|
rest = line[command.length..].strip.freeze
|
||||||
[command, rest].freeze
|
[command, rest].freeze
|
||||||
end
|
end
|
||||||
|
@ -31,6 +31,7 @@ workdir = File.expand_path(workdir).freeze
|
||||||
|
|
||||||
config = Referator::Config.new workdir
|
config = Referator::Config.new workdir
|
||||||
footnotes = Referator::Footnotes.new config
|
footnotes = Referator::Footnotes.new config
|
||||||
|
stacktrace = nil
|
||||||
|
|
||||||
while (line = $stdin.gets)
|
while (line = $stdin.gets)
|
||||||
begin
|
begin
|
||||||
|
@ -39,6 +40,11 @@ while (line = $stdin.gets)
|
||||||
when 'EXIT'
|
when 'EXIT'
|
||||||
success
|
success
|
||||||
exit
|
exit
|
||||||
|
when 'PING'
|
||||||
|
success :pong
|
||||||
|
when 'STACKTRACE'
|
||||||
|
success stacktrace
|
||||||
|
stacktrace = nil
|
||||||
when 'REGISTER_FORMAT'
|
when 'REGISTER_FORMAT'
|
||||||
data = JSON.parse rest
|
data = JSON.parse rest
|
||||||
config.formats.register(
|
config.formats.register(
|
||||||
|
@ -76,6 +82,7 @@ while (line = $stdin.gets)
|
||||||
raise 'Invalid command'
|
raise 'Invalid command'
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
|
stacktrace = e.backtrace.map(&:freeze).freeze
|
||||||
failure e.detailed_message
|
failure e.detailed_message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue