On Wed, 14 Jan 2009, David Golden wrote:

> Note -- my rule is "one strike and you're out".  Once a distribution causes
> me trouble in automated testing (hanging, manual prompts, opening windows
> that don't close, etc.), it goes in the penalty box.  That may be more
> aggressive than you might want.

Not sure if you are already doing this, but here is a bit of code that I
use for my smoke testing. It disables the Windows critical error
messages boxes and just fails with an error code. This setting is
inherited by all child processes too. Requires Win32::API though and
therefore won't work with 64-bit Perl.

# MSWin32: Disable critical error popups and slightly lower priority
if ($^O eq "MSWin32") {
    # Call kernel32.SetErrorMode(SEM_FAILCRITICALERRORS):
    # "The system does not display the critical-error-handler message box.
    # Instead, the system sends the error to the calling process." and
    # "A child process inherits the error mode of its parent process."
    if (eval {require Win32::API}) {
        my $SetErrorMode
            = Win32::API->new('kernel32', 'SetErrorMode', 'I', 'I');
        my $SEM_FAILCRITICALERRORS = 0x0001;
        my $SEM_NOGPFAULTERRORBOX  = 0x0002;
        $SetErrorMode->Call($SEM_FAILCRITICALERRORS | $SEM_NOGPFAULTERRORBOX);
    }
    # Set priority just below normal (on Win2K and later)
    require Win32;
    my (undef, $major, undef, undef, $id) = Win32::GetOSVersion();
    if ($id == 2 && $major >= 5 && eval {require Win32::Process}) {
        Win32::Process::Open(my $proc, $$, 0);
        # constant not defined by older Win32::Process versions
        my $BELOW_NORMAL_PRIORITY_CLASS = 0x00004000;
        $proc->SetPriorityClass($BELOW_NORMAL_PRIORITY_CLASS);
    }
}

Cheers,
-Jan

Reply via email to