diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-01 18:51:07 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-01 18:51:07 +0100 |
commit | 43e6512a0d4abd296f3672593a524a814e7f3e14 (patch) | |
tree | 60d9005dfd9bdc1ed9f806bb010cff70c25290e8 /Bugzilla/Install | |
parent | 61c5777bf9539b94c7cc3188a7970f1bd819adfa (diff) | |
download | bugzilla-43e6512a0d4abd296f3672593a524a814e7f3e14.tar.gz bugzilla-43e6512a0d4abd296f3672593a524a814e7f3e14.tar.xz |
Bug 480968: Make checksetup.pl never show popup windows for errors, on Windows, to work around the error that pops up every time it tries to load DBD::Oracle.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=Wurblzap, a=mkanat
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r-- | Bugzilla/Install/Util.pm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 1f4a7c1b9..1c6d5c4ee 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -548,6 +548,28 @@ sub init_console { eval { ON_WINDOWS && require Win32::Console::ANSI; }; $ENV{'ANSI_COLORS_DISABLED'} = 1 if ($@ || !-t *STDOUT); $ENV{'HTTP_ACCEPT_LANGUAGE'} ||= get_console_locale(); + prevent_windows_dialog_boxes(); +} + +sub prevent_windows_dialog_boxes { + # This code comes from http://bugs.activestate.com/show_bug.cgi?id=82183 + # and prevents Perl modules from popping up dialog boxes, particularly + # during checksetup (since loading DBD::Oracle during checksetup when + # Oracle isn't installed causes a scary popup and pauses checksetup). + # + # Win32::API ships with ActiveState by default, though there could + # theoretically be a Windows installation without it, I suppose. + if (ON_WINDOWS and eval { require Win32::API }) { + # Call kernel32.SetErrorMode with arguments that mean: + # "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." + my $SetErrorMode = Win32::API->new('kernel32', 'SetErrorMode', + 'I', 'I'); + my $SEM_FAILCRITICALERRORS = 0x0001; + my $SEM_NOGPFAULTERRORBOX = 0x0002; + $SetErrorMode->Call($SEM_FAILCRITICALERRORS | $SEM_NOGPFAULTERRORBOX); + } } # This is like request_cache, but it's used only by installation code |