mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Add PostgreSQL::Test::Cluster::config_data()
This is useful to grab some configuration information from a node already set up, and I personally found two cases for it: pg_upgrade and a test to emulate check_guc. Author: Michael Paquier Discussion: https://postgr.es/m/20211129030833.GJ17618@telsasoft.com Discussion: https://postgr.es/m/YJ8xTmLQkotVLpN5@paquier.xyz
This commit is contained in:
@ -327,6 +327,31 @@ sub install_path
|
|||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
|
||||||
|
=item $node->config_data($option)
|
||||||
|
|
||||||
|
Return a string holding configuration data from pg_config, with $option
|
||||||
|
being the option switch used with the pg_config command.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub config_data
|
||||||
|
{
|
||||||
|
my ($self, $option) = @_;
|
||||||
|
local %ENV = $self->_get_env();
|
||||||
|
|
||||||
|
my ($stdout, $stderr);
|
||||||
|
my $result =
|
||||||
|
IPC::Run::run [ $self->installed_command('pg_config'), $option ],
|
||||||
|
'>', \$stdout, '2>', \$stderr
|
||||||
|
or die "could not execute pg_config";
|
||||||
|
chomp($stdout);
|
||||||
|
$stdout =~ s/\r$//;
|
||||||
|
|
||||||
|
return $stdout;
|
||||||
|
}
|
||||||
|
|
||||||
|
=pod
|
||||||
|
|
||||||
=item $node->info()
|
=item $node->info()
|
||||||
|
|
||||||
Return a string containing human-readable diagnostic information (paths, etc)
|
Return a string containing human-readable diagnostic information (paths, etc)
|
||||||
|
Reference in New Issue
Block a user