1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Ensure that info output is terminated by a linefeed.

On some systems the JSON->encode() function was adding a linefeed and on others it was not.  This was causing regression test failures in in the test logs and may have also been inconvenient for users.
This commit is contained in:
David Steele
2015-08-01 17:23:28 -04:00
parent 1b0f997f59
commit 021afa8046

View File

@@ -136,7 +136,16 @@ sub info
elsif (optionTest(OPTION_OUTPUT, INFO_OUTPUT_JSON))
{
my $oJSON = JSON::PP->new()->canonical()->pretty()->indent_length(4);
syswrite(*STDOUT, $oJSON->encode($oStanzaList));
my $strJSON = $oJSON->encode($oStanzaList);
syswrite(*STDOUT, $strJSON);
# On some systems a linefeed will be appended by encode() but others will not have it. In our case there should always
# be a terminating linefeed.
if ($strJSON !~ /\n$/)
{
syswrite(*STDOUT, "\n");
}
}
else
{