Skip to content

Commit 2a3bdf2

Browse files
reckless: close log socket before stdout
Otherwise reckless-rpc can be concerned that the reckless utility process didn't exit cleanly.
1 parent 0c3008d commit 2a3bdf2

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

plugins/recklessrpc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ static void reckless_conn_finish(struct io_conn *conn,
152152
/* FIXME: avoid EBADFD - leave stdin fd open? */
153153
if (errno && errno != 9)
154154
plugin_log(plugin, LOG_DBG, "err: %s", strerror(errno));
155+
struct pollfd pfd = { .fd = reckless->logfd, .events = POLLIN };
156+
poll(&pfd, 1, 20); // wait for any remaining log data
155157
if (reckless->pid > 0) {
156158
int status = 0;
157159
pid_t p;

tests/test_reckless.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def test_tag_install(node_factory):
419419

420420
# Note: uv timeouts from the GH network seem to happen?
421421
@pytest.mark.slow_test
422-
@pytest.mark.flaky(reruns=3)
422+
@pytest.mark.flaky(max_runs=3)
423423
def test_reckless_uv_install(node_factory):
424424
node = get_reckless_node(node_factory)
425425
node.start()

tools/reckless

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,3 +2556,8 @@ if __name__ == '__main__':
25562556

25572557
if log.capture:
25582558
log.reply_json()
2559+
# Allow log streaming socket to close before process exits
2560+
time.sleep(0.20)
2561+
if log.socket:
2562+
log.socket.close()
2563+
time.sleep(0.001)

0 commit comments

Comments
 (0)