Wait for user input in the debug console

This way, Geany's standard out and error can be read if started in verbose
mode until a key is pressed which makes debugging of command line
actions easier.
This commit is contained in:
Enrico Trger 2011-10-23 16:32:22 +02:00
parent c51129db6e
commit 3fd7e9f68e

View File

@ -479,6 +479,18 @@ static void print_filetypes(void)
} }
static void wait_for_input_on_windows(void)
{
#ifdef G_OS_WIN32
if (verbose_mode)
{
geany_debug("Press any key to continue");
getchar();
}
#endif
}
static void parse_command_line_options(gint *argc, gchar ***argv) static void parse_command_line_options(gint *argc, gchar ***argv)
{ {
GError *error = NULL; GError *error = NULL;
@ -514,6 +526,12 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
exit(1); exit(1);
} }
app->debug_mode = verbose_mode;
#ifdef G_OS_WIN32
win32_init_debug_code();
#endif
if (show_version) if (show_version)
{ {
printf(PACKAGE " %s (", main_get_version_string()); printf(PACKAGE " %s (", main_get_version_string());
@ -523,6 +541,7 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
printf(")\n"); printf(")\n");
wait_for_input_on_windows();
exit(0); exit(0);
} }
@ -532,15 +551,10 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
printf("%s\n", GEANY_DATADIR); printf("%s\n", GEANY_DATADIR);
printf("%s\n", GEANY_LIBDIR); printf("%s\n", GEANY_LIBDIR);
printf("%s\n", GEANY_LOCALEDIR); printf("%s\n", GEANY_LOCALEDIR);
wait_for_input_on_windows();
exit(0); exit(0);
} }
app->debug_mode = verbose_mode;
#ifdef G_OS_WIN32
win32_init_debug_code();
#endif
if (alternate_config) if (alternate_config)
{ {
geany_debug("alternate config: %s", alternate_config); geany_debug("alternate config: %s", alternate_config);
@ -558,12 +572,14 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
filetypes_init_types(); filetypes_init_types();
ret = symbols_generate_global_tags(*argc, *argv, ! no_preprocessing); ret = symbols_generate_global_tags(*argc, *argv, ! no_preprocessing);
filetypes_free_types(); filetypes_free_types();
wait_for_input_on_windows();
exit(ret); exit(ret);
} }
if (ft_names) if (ft_names)
{ {
print_filetypes(); print_filetypes();
wait_for_input_on_windows();
exit(0); exit(0);
} }