commit eed75362a5ea63dce575b27a7891b3390ea52bdb from: Omar Polo date: Fri Aug 06 20:19:20 2021 UTC ignore IMSG_MSIZE and send IMSG_CONN_GONE after running a test commit - 1be0a2761223329d982a83674908b3a58f8790a5 commit + eed75362a5ea63dce575b27a7891b3390ea52bdb blob - 39be115836d70a90186dd39b811dea75652428b7 blob + 33a2cdbf89c83c0d7ffda564b38bdddd601d8f8d --- script.c +++ script.c @@ -1135,14 +1135,6 @@ builtin_send(int argc) } imsg_close(&ibuf, buf); - -#if DEBUG - { - void *data = TAILQ_FIRST(&ibuf.w.bufs)->buf; - size_t len = TAILQ_FIRST(&ibuf.w.bufs)->size; - hexdump("IMSG_BUF", data, len); - } -#endif if (imsg_flush(&ibuf) == -1) { i = errno; @@ -1190,6 +1182,7 @@ disconnect: return EVAL_ERR; } +nextmessage: /* read only one message */ if ((n = imsg_get(&ibuf, &imsg)) == -1) fatal("imsg_get"); @@ -1214,6 +1207,10 @@ disconnect: imsg_free(&imsg); return EVAL_ERR; + case IMSG_MSIZE: + imsg_free(&imsg); + goto nextmessage; + default: before_printing(); printf("got unknown message from subprocess: %d\n", @@ -1315,6 +1312,9 @@ run_test(struct test *t) prepare_child_for_test(t); ret = eval(t->body); + imsg_compose(&ibuf, IMSG_CONN_GONE, 0, 0, -1, NULL, 0); + imsg_flush(&ibuf); + while (waitpid(pid, NULL, 0) != pid) ; /* nop */