Skip to content

Commit

Permalink
lib/Rex/Config.pm: slurp file content using IO::File.
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurp committed Oct 13, 2021
1 parent fa11474 commit 73badfc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/Rex/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,11 @@ sub read_config_file {
$config_file ||= _home_dir() . "/.rex/config.yml";

if ( -f $config_file ) {
my $yaml = eval { local ( @ARGV, $/ ) = ($config_file); <>; };
my $yaml = eval {
use IO::File;
my $fh = IO::File->new( $config_file, 'r' );
join '', $fh->getlines();
};
eval { $HOME_CONFIG_YAML = Load($yaml); };

if ($@) {
Expand All @@ -1762,7 +1766,11 @@ sub read_ssh_config_file {
$config_file ||= _home_dir() . '/.ssh/config';

if ( -f $config_file ) {
my @lines = eval { local (@ARGV) = ($config_file); <>; };
my @lines = eval {
use IO::File;
my $fh = IO::File->new( $config_file, 'r' );
join '', $fh->getlines();
};
%SSH_CONFIG_FOR = _parse_ssh_config(@lines);
}
}
Expand Down

0 comments on commit 73badfc

Please sign in to comment.