klippy: Return an error code if batch input results in an error

When reading from a debug input file, propagate any errors to the
program return status.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-06-16 15:15:17 -04:00
parent efe63d5efe
commit 780e3c3022
2 changed files with 21 additions and 11 deletions

View file

@ -105,7 +105,7 @@ class GCodeParser:
self.gcode_handlers = self.base_gcode_handlers
self.dump_debug()
if self.is_fileinput:
self.printer.request_exit()
self.printer.request_exit('error_exit')
return
if state != 'ready':
return
@ -264,6 +264,8 @@ class GCodeParser:
if len(lines) > 1:
self.respond_info("\n".join(lines))
self.respond('!! %s' % (lines[0].strip(),))
if self.is_fileinput:
self.printer.request_exit('error_exit')
# Parameter parsing helpers
class sentinel: pass
def get_str(self, name, params, default=sentinel, parser=str,