mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 21:19:59 +00:00
Normalize newlines on end of JSON text, to handle whatever is wrong with JSON on CentOS 6.
This commit is contained in:
@@ -53,9 +53,14 @@ sub as_json {
|
|||||||
$json->allow_blessed([]);
|
$json->allow_blessed([]);
|
||||||
$json->convert_blessed([]);
|
$json->convert_blessed([]);
|
||||||
|
|
||||||
return $json->encode(
|
my $text = $json->encode(
|
||||||
ref $resource eq 'ARRAY' ? $resource : as_hashref($resource, %args)
|
ref $resource eq 'ARRAY' ? $resource : as_hashref($resource, %args)
|
||||||
);
|
);
|
||||||
|
if ( $args{json} && $text ) { # for testing
|
||||||
|
chomp($text);
|
||||||
|
$text .= "\n";
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub as_config {
|
sub as_config {
|
||||||
|
Reference in New Issue
Block a user