Message ID | 20240912092253.119754-4-hadess@hadess.net |
---|---|
State | New |
Headers | show |
Series | Fix bluetoothctl hanging if daemon isn't running | expand |
On Thu, 2024-09-12 at 11:11 -0400, Luiz Augusto von Dentz wrote: > Hi Bastien, > > On Thu, Sep 12, 2024 at 5:29 AM Bastien Nocera <hadess@hadess.net> > wrote: > > > > Exit after handling --help, so as to avoid the daemon waiting to > > communicate with a D-Bus service that might not be running. > > --- > > src/shared/shell.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/src/shared/shell.c b/src/shared/shell.c > > index c31487190d0f..f7e8b3300373 100644 > > --- a/src/shared/shell.c > > +++ b/src/shared/shell.c > > @@ -1324,9 +1324,7 @@ void bt_shell_init(int argc, char **argv, > > const struct bt_shell_opt *opt) > > return; > > case 'h': > > usage(argc, argv, opt); > > - data.argc = 1; > > - data.argv = &cmplt; > > - data.mode = 1; > > + exit(EXIT_SUCCESS); > > This would undo shared/shell: Print commands when --help option is > given, so you might want to add print_cmds call. That wasn't enough, because the menu info isn't populated at this point, so we'd only get the top-level help. It was quite a bit more involved, but I hope I got all variants covered in the v2 patchset. Cheers > > > goto done; > > case 's': > > if (optarg && data.init_fd < 0) { > > -- > > 2.46.0 > > > > > >
diff --git a/src/shared/shell.c b/src/shared/shell.c index c31487190d0f..f7e8b3300373 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1324,9 +1324,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) return; case 'h': usage(argc, argv, opt); - data.argc = 1; - data.argv = &cmplt; - data.mode = 1; + exit(EXIT_SUCCESS); goto done; case 's': if (optarg && data.init_fd < 0) {