maildir: improve unit tests

And get some more info from run_command.
This commit is contained in:
Dirk-Jan C. Binnema 2023-09-24 21:33:18 +03:00
parent 4a0eba8ddf
commit ee18c02762
2 changed files with 7 additions and 1 deletions

View File

@ -98,6 +98,8 @@ test_maildir_mkdir_03()
static void
test_maildir_mkdir_04()
{
allow_warnings();
if (geteuid() == 0) {
g_test_skip("not useful when run as root");
return;

View File

@ -298,7 +298,11 @@ Mu::run_command0(std::initializer_list<std::string> args, bool try_setsid)
if (auto&& res{run_command(args, try_setsid)}; !res)
return res;
else if (res->exit_code != 0)
return Err(Error::Code::File, "command ran with non-zero exit code");
return Err(Error::Code::File, "command returned {}: {}",
res->exit_code,
res->standard_err.empty() ?
std::string{"something went wrong"}:
res->standard_err);
else
return Ok(std::move(*res));
}