mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Fix Perl coding error in msvc build system
Code like open(P, "cl /? 2>&1 |") || die "cl command not found"; does not actually catch any errors, because the exit status of the command before the pipe is ignored. The fix is to look at $?. This also gave the opportunity to clean up the logic of this code a bit.
This commit is contained in:
@ -71,17 +71,9 @@ sub DeterminePlatform
|
||||
my $self = shift;
|
||||
|
||||
# Examine CL help output to determine if we are in 32 or 64-bit mode.
|
||||
$self->{platform} = 'Win32';
|
||||
open(P, "cl /? 2>&1 |") || die "cl command not found";
|
||||
while (<P>)
|
||||
{
|
||||
if (/^\/favor:<.+AMD64/)
|
||||
{
|
||||
$self->{platform} = 'x64';
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(P);
|
||||
my $output = `cl /? 2>&1`;
|
||||
$? >> 8 == 0 or die "cl command not found";
|
||||
$self->{platform} = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
|
||||
print "Detected hardware platform: $self->{platform}\n";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user