]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 480968: Make checksetup.pl never show popup windows for errors, on Windows, to...
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Mon, 1 Feb 2010 17:54:47 +0000 (09:54 -0800)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Mon, 1 Feb 2010 17:54:47 +0000 (09:54 -0800)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=Wurblzap, a=mkanat

Bugzilla/Install/Util.pm
checksetup.pl

index 35a855e8d7c0161374e13ea311842d7bfc257cb7..d9a564f105771da19c380557cb6c47df4112c23b 100644 (file)
@@ -43,6 +43,7 @@ our @EXPORT_OK = qw(
     template_include_path
     vers_cmp
     get_console_locale
+    prevent_windows_dialog_boxes
 );
 
 sub bin_loc {
@@ -332,6 +333,26 @@ sub get_console_locale {
     return $locale;
 }
 
+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
 # for setup.cgi and things like that.
index da368a822cc7db06baac87c92731adb8e765c65a..2c29d4e38916f790360f392ef5f1243d43929492 100755 (executable)
@@ -53,12 +53,15 @@ BEGIN { chdir dirname($0); }
 use lib qw(. lib);
 use Bugzilla::Constants;
 use Bugzilla::Install::Requirements;
-use Bugzilla::Install::Util qw(install_string get_version_and_os get_console_locale);
+use Bugzilla::Install::Util qw(install_string get_version_and_os 
+                               get_console_locale
+                               prevent_windows_dialog_boxes);
 
 ######################################################################
 # Live Code
 ######################################################################
 
+prevent_windows_dialog_boxes();
 # When we're running at the command line, we need to pick the right
 # language before ever displaying any string.
 $ENV{'HTTP_ACCEPT_LANGUAGE'} ||= get_console_locale();