moo_(en/dis)able_win32_error_message(), for plugins and terminal

master
Yevgen Muntyan 2006-06-14 23:39:34 -05:00
parent e229f869e0
commit 42b16f2c8b
3 changed files with 29 additions and 0 deletions

View File

@ -677,6 +677,8 @@ run_in_helper (const char *cmd,
sinfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
sinfo.wShowWindow = SW_HIDE;
_moo_disable_win32_error_message ();
if (! CreateProcess (helper_binary->str, cmd_line, NULL, NULL, TRUE,
CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP,
NULL, HELPER_DIR, &sinfo, &pinfo))
@ -685,9 +687,14 @@ run_in_helper (const char *cmd,
g_set_error (error, MOO_TERM_ERROR, MOO_TERM_ERROR_FAILED,
"CreateProcess: %s", msg);
g_free (msg);
_moo_enable_win32_error_message ();
goto error;
}
_moo_enable_win32_error_message ();
g_free (cmd_line);
cmd_line = NULL;

View File

@ -1534,3 +1534,23 @@ moo_splitlines (const char *string)
g_ptr_array_add (array, NULL);
return (char**) g_ptr_array_free (array, FALSE);
}
G_GNUC_UNUSED static guint
saved_win32_error_mode;
void
_moo_disable_win32_error_message (void)
{
#ifdef __WIN32__
saved_win32_error_mode = SetErrorMode (SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
#endif
}
void
_moo_enable_win32_error_message (void)
{
#ifdef __WIN32__
SetErrorMode (saved_win32_error_mode);
#endif
}

View File

@ -50,6 +50,8 @@ void moo_reset_log_func (void);
void moo_segfault (void);
gboolean moo_debug_enabled (void) G_GNUC_CONST;
void _moo_disable_win32_error_message(void);
void _moo_enable_win32_error_message (void);
#define MOO_TYPE_DATA_DIR_TYPE (moo_data_dir_type_get_type ())