Improve capture of pg_rewind stderr output

As it seems redirecting stderr to stdin (2>&1) when executing
system commands results in a SIGPIPE (141) return code, making
it impossible to determine the actual return code, redirect
stderr to a temporary file and collate the output from that.

There are possibly better ways of doing this which could
be revisited at a future date.
This commit is contained in:
Ian Barwick
2020-10-15 14:00:59 +09:00
parent 725e9f9851
commit ac2feba380
2 changed files with 57 additions and 6 deletions

View File

@@ -2843,7 +2843,7 @@ do_node_rejoin(void)
if (ret == false)
{
log_error(_("unable to execute pg_rewind"));
log_error(_("pg_rewind execution failed"));
log_detail("%s", command_output.data);
termPQExpBuffer(&command_output);