diff options
-rw-r--r-- | tests/libqtest.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c index 3a0e0d63a7..951a3b4bf6 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -442,14 +442,20 @@ void qmp_fd_sendv(int fd, const char *fmt, va_list ap) if (qobj) { int log = getenv("QTEST_LOG") != NULL; QString *qstr = qobject_to_json(qobj); - const char *str = qstring_get_str(qstr); - size_t size = qstring_get_length(qstr); + const char *str; + + /* + * BUG: QMP doesn't react to input until it sees a newline, an + * object, or an array. Work-around: give it a newline. + */ + qstring_append_chr(qstr, '\n'); + str = qstring_get_str(qstr); if (log) { fprintf(stderr, "%s", str); } /* Send QMP request */ - socket_send(fd, str, size); + socket_send(fd, str, qstring_get_length(qstr)); QDECREF(qstr); qobject_decref(qobj); |