mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 16:05:05 +02:00
Report failures to write to child
This commit is contained in:
@@ -221,10 +221,11 @@ needs_write(ChildMonitor *self, PyObject *args) {
|
||||
unsigned long id, sz;
|
||||
const char *data;
|
||||
if (!PyArg_ParseTuple(args, "ks#", &id, &data, &sz)) return NULL;
|
||||
if (!sz) { Py_RETURN_NONE; }
|
||||
PyObject *found = Py_False;
|
||||
children_mutex(lock);
|
||||
for (size_t i = 0; i < self->count; i++) {
|
||||
if (children[i].id == id) {
|
||||
found = Py_True;
|
||||
Screen *screen = children[i].screen;
|
||||
screen_mutex(lock, write);
|
||||
uint8_t *buf = PyMem_RawRealloc(screen->write_buf, screen->write_buf_sz + sz);
|
||||
@@ -240,7 +241,8 @@ needs_write(ChildMonitor *self, PyObject *args) {
|
||||
}
|
||||
children_mutex(unlock);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
Py_RETURN_NONE;
|
||||
Py_INCREF(found);
|
||||
return found;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import sys
|
||||
import weakref
|
||||
from collections import deque
|
||||
from time import monotonic
|
||||
from itertools import count
|
||||
from time import monotonic
|
||||
|
||||
from .char_grid import CharGrid, DynamicColor
|
||||
from .constants import (
|
||||
@@ -112,8 +113,10 @@ class Window:
|
||||
|
||||
def write_to_child(self, data):
|
||||
if data:
|
||||
get_boss().child_monitor.needs_write(self.id, data)
|
||||
wakeup()
|
||||
if get_boss().child_monitor.needs_write(self.id, data) is True:
|
||||
wakeup()
|
||||
else:
|
||||
print('Failed to write to child %d as it does not exist' % self.id, file=sys.stderr)
|
||||
|
||||
def bell(self):
|
||||
if self.opts.enable_audio_bell:
|
||||
|
||||
Reference in New Issue
Block a user