mirror of https://github.com/djcb/mu.git
maildir: improve unit tests
And get some more info from run_command.
This commit is contained in:
parent
4a0eba8ddf
commit
ee18c02762
|
@ -98,6 +98,8 @@ test_maildir_mkdir_03()
|
||||||
static void
|
static void
|
||||||
test_maildir_mkdir_04()
|
test_maildir_mkdir_04()
|
||||||
{
|
{
|
||||||
|
allow_warnings();
|
||||||
|
|
||||||
if (geteuid() == 0) {
|
if (geteuid() == 0) {
|
||||||
g_test_skip("not useful when run as root");
|
g_test_skip("not useful when run as root");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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)
|
if (auto&& res{run_command(args, try_setsid)}; !res)
|
||||||
return res;
|
return res;
|
||||||
else if (res->exit_code != 0)
|
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
|
else
|
||||||
return Ok(std::move(*res));
|
return Ok(std::move(*res));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue