mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2026-10-24 00:49:00 +03:00
gio: Handle "gio help help" correctly
Avoid triggering an assertion when requesting help for the help subcommand. Instead, report that help cannot be displayed for the help subcommand and exit with an error. Fixes: #4007
This commit is contained in:
committed by
Philip Withnall
parent
90b0a7e9de
commit
cb9e99bcc2
@@ -344,6 +344,12 @@ main (int argc, char **argv)
|
||||
{
|
||||
if (g_str_equal (command, gio_subcommands[i].name))
|
||||
{
|
||||
if (g_str_equal (command, "help"))
|
||||
{
|
||||
usage (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_assert (gio_subcommands[i].handle_func != NULL);
|
||||
return gio_subcommands[i].handle_func (argc, argv, do_help);
|
||||
}
|
||||
|
||||
@@ -56,10 +56,14 @@ class TestGioTool(testprogramrunner.TestProgramRunner):
|
||||
"""Test the --help argument and help subcommand."""
|
||||
result = self.runGio("--help")
|
||||
result2 = self.runGio("help")
|
||||
result3 = self.runGio("help", "help")
|
||||
|
||||
self.assertEqual(result.out, result2.out)
|
||||
self.assertEqual(result.err, result2.err)
|
||||
|
||||
self.assertEqual(result2.out, result3.out)
|
||||
self.assertEqual(result2.err, result3.err)
|
||||
|
||||
self.assertIn("Usage:\n gio COMMAND", result.out)
|
||||
self.assertIn("List the contents of locations", result.out)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user