Skip to content

Commit

Permalink
Wait for user input in the debug console
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eht16 committed Oct 23, 2011
1 parent c51129d commit 3fd7e9f
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
GError *error = NULL;
Expand Down Expand Up @@ -514,6 +526,12 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
exit(1);
}

app->debug_mode = verbose_mode;

#ifdef G_OS_WIN32
win32_init_debug_code();
#endif

if (show_version)
{
printf(PACKAGE " %s (", main_get_version_string());
Expand All @@ -523,6 +541,7 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
printf(")\n");
wait_for_input_on_windows();
exit(0);
}

Expand All @@ -532,15 +551,10 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
printf("%s\n", GEANY_DATADIR);
printf("%s\n", GEANY_LIBDIR);
printf("%s\n", GEANY_LOCALEDIR);
wait_for_input_on_windows();
exit(0);
}

app->debug_mode = verbose_mode;

#ifdef G_OS_WIN32
win32_init_debug_code();
#endif

if (alternate_config)
{
geany_debug("alternate config: %s", alternate_config);
Expand All @@ -558,12 +572,14 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
filetypes_init_types();
ret = symbols_generate_global_tags(*argc, *argv, ! no_preprocessing);
filetypes_free_types();
wait_for_input_on_windows();
exit(ret);
}

if (ft_names)
{
print_filetypes();
wait_for_input_on_windows();
exit(0);
}

Expand Down

0 comments on commit 3fd7e9f

Please sign in to comment.