Add a --dump-bytes option, useful for reproducing problems from users computers
This commit is contained in:
parent
15c4b1961e
commit
c504b96b60
@ -98,6 +98,11 @@ def option_parser():
|
|||||||
default=None,
|
default=None,
|
||||||
help=_('Replay previously dumped commands')
|
help=_('Replay previously dumped commands')
|
||||||
)
|
)
|
||||||
|
a(
|
||||||
|
'--dump-bytes',
|
||||||
|
help=_('Path to file in which to store the raw bytes received from the'
|
||||||
|
' child process. Useful for debugging.')
|
||||||
|
)
|
||||||
a(
|
a(
|
||||||
'--debug-gl',
|
'--debug-gl',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
@ -753,6 +753,11 @@ FNAME(read_bytes)(PyObject UNUSED *self, PyObject *args) {
|
|||||||
/* PyObject_Print(Py_BuildValue("y#", screen->read_buf, len), stderr, 0); */
|
/* PyObject_Print(Py_BuildValue("y#", screen->read_buf, len), stderr, 0); */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef DUMP_COMMANDS
|
||||||
|
if (len > 0) {
|
||||||
|
Py_XDECREF(PyObject_CallFunction(dump_callback, "sy#", "bytes", screen->read_buf, len)); PyErr_Clear();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
_parse_bytes(screen, screen->read_buf, len, dump_callback);
|
_parse_bytes(screen, screen->read_buf, len, dump_callback);
|
||||||
if(len > 0) { Py_RETURN_TRUE; }
|
if(len > 0) { Py_RETURN_TRUE; }
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
|
|||||||
@ -39,7 +39,9 @@ class Window:
|
|||||||
self.child_fd = child.child_fd
|
self.child_fd = child.child_fd
|
||||||
self.start_visual_bell_at = None
|
self.start_visual_bell_at = None
|
||||||
self.screen = Screen(self, 24, 80, opts.scrollback_lines)
|
self.screen = Screen(self, 24, 80, opts.scrollback_lines)
|
||||||
self.read_bytes = partial(read_bytes_dump, self.dump_commands) if args.dump_commands else read_bytes
|
self.read_bytes = partial(read_bytes_dump, self.dump_commands) if args.dump_commands or args.dump_bytes else read_bytes
|
||||||
|
if args.dump_bytes:
|
||||||
|
self.dump_bytes_to = open(args.dump_bytes, 'ab')
|
||||||
self.draw_dump_buf = []
|
self.draw_dump_buf = []
|
||||||
self.write_buf = memoryview(b'')
|
self.write_buf = memoryview(b'')
|
||||||
self.char_grid = CharGrid(self.screen, opts)
|
self.char_grid = CharGrid(self.screen, opts)
|
||||||
@ -347,6 +349,9 @@ class Window:
|
|||||||
self.draw_dump_buf = []
|
self.draw_dump_buf = []
|
||||||
else:
|
else:
|
||||||
self.draw_dump_buf.append(a[1])
|
self.draw_dump_buf.append(a[1])
|
||||||
|
elif a[0] == 'bytes':
|
||||||
|
self.dump_bytes_to.write(a[1])
|
||||||
|
self.dump_bytes_to.flush()
|
||||||
else:
|
else:
|
||||||
if self.draw_dump_buf:
|
if self.draw_dump_buf:
|
||||||
safe_print('draw', ''.join(self.draw_dump_buf))
|
safe_print('draw', ''.join(self.draw_dump_buf))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user