I'm not sure whether the following coding actually detects any errors: Solution.pm:
open(P, "cl /? 2>&1 |") || die "cl command not found"; VSObjectFactory.pm: open(P, "nmake /? 2>&1 |") || croak "Unable to determine Visual Studio version: The nmake command wasn't found."; The problem is that because of the shell special characters, the command is run through the shell, but the shell ignores the exit status of anything but the last command in the pipe. And the perlopentut man page says "In such a case, the "open" call will only indicate failure if Perl can't even run the shell.". I can confirm that on a *nix system. It might be different on Windows, but it doesn't seem so. The whole thing could probably be written in a less complicated way using backticks, like --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -72,16 +72,13 @@ sub DeterminePlatform # 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>) + my $output = `cl /? 2>&1`; + $? >> 8 == 0 or die "cl command not found"; + if ($output =~ /^\/favor:<.+AMD64/) { - if (/^\/favor:<.+AMD64/) - { - $self->{platform} = 'x64'; - last; - } + $self->{platform} = 'x64'; + last; } - close(P); print "Detected hardware platform: $self->{platform}\n"; } -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers