From 501d27ad89c70d746e792896e11e98df96d46f87 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 27 Jul 2026 20:12:23 +0300 Subject: [PATCH] mu-server: tweak server Try to set a larger pipe size (on Linux); and only show the mu-prompt when talking to a tty. --- lib/utils/mu-readline.cc | 3 ++- mu/mu-cmd-server.cc | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/utils/mu-readline.cc b/lib/utils/mu-readline.cc index edf6a52e..6290df96 100644 --- a/lib/utils/mu-readline.cc +++ b/lib/utils/mu-readline.cc @@ -117,7 +117,8 @@ Mu::read_line(bool& do_quit) #endif /*HAVE_READLINE*/ std::string line; - mu_print(";; mu> "); + if (is_a_tty) /* avoid uncookied noise for e.g. mu4e */ + mu_print(";; mu> "); if (!std::getline(std::cin, line)) do_quit = true; diff --git a/mu/mu-cmd-server.cc b/mu/mu-cmd-server.cc index f8d843d0..d9b617d0 100644 --- a/mu/mu-cmd-server.cc +++ b/mu/mu-cmd-server.cc @@ -25,6 +25,7 @@ #include #include +#include #include "mu-cmd.hh" #include "mu-server.hh" @@ -162,6 +163,15 @@ Mu::mu_cmd_server(const Mu::Options& opts) try { // --eval/--commands as well. tty = ::isatty(::fileno(stdout)); +#ifdef F_SETPIPE_SZ + /* when talking to mu4e over a pipe, enlarge it (best-effort; Linux + * only). with the default 64k, we stall on writing big result batches + * while the client is busy rendering earlier results; with a bigger + * pipe, producing results and rendering them can overlap. */ + if (!tty) + ::fcntl(::fileno(stdout), F_SETPIPE_SZ, 1024 * 1024); +#endif /*F_SETPIPE_SZ*/ + Server::Options sopts{opts.server.allow_temp_file, socket_path}; Server server{*store, sopts, output_stdout};