mu-server: tweak server

Try to set a larger pipe size (on Linux); and only show the mu-prompt
when talking to a tty.
This commit is contained in:
Dirk-Jan C. Binnema
2026-07-27 20:12:23 +03:00
committed by Seth Ladygo
parent ca5e1d64c1
commit 501d27ad89
2 changed files with 12 additions and 1 deletions

View File

@ -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;

View File

@ -25,6 +25,7 @@
#include <cstdio>
#include <unistd.h>
#include <fcntl.h>
#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};