.gitignore: ignore local vscode workspace settings file
[lttng-tools.git] / src / bin / lttng / commands / destroy.cpp
index 0258e31e858ced1d61dfb76a85d916f6932d203c..ef4b914d38bd39f124debce1dfb31600ba572a50 100644 (file)
@@ -7,6 +7,7 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
+#include "../exception.hpp"
 
 #include <common/exception.hpp>
 #include <common/make-unique-wrapper.hpp>
@@ -110,7 +111,8 @@ cmd_error_code destroy_session(const lttng_session& session)
                } while (ret != 0);
        }
 
-       std::unique_ptr<char, lttng::memory::create_deleter_class<char, lttng::free>::deleter>
+       std::unique_ptr<char,
+                       lttng::memory::create_deleter_class<char, lttng::memory::free>::deleter>
                stats_str;
        if (!session_was_already_stopped) {
                char *raw_stats_str = nullptr;
@@ -242,7 +244,7 @@ cmd_error_code destroy_session(const lttng_session& session)
         * destroy the file.
         */
        const auto session_name =
-               lttng::make_unique_wrapper<char, lttng::free>(get_session_name_quiet());
+               lttng::make_unique_wrapper<char, lttng::memory::free>(get_session_name_quiet());
        if (session_name && !strncmp(session.name, session_name.get(), NAME_MAX)) {
                config_destroy_default();
        }
@@ -271,6 +273,14 @@ cmd_error_code destroy_sessions(const lttng::cli::session_spec& spec)
                                lttng_strerror(-ctl_exception.code()));
                        listing_failed = true;
                        return {};
+               } catch (const lttng::cli::no_default_session_error& cli_exception) {
+                       /*
+                        * The retrieval of the default session name already logs
+                        * an error when it fails. There is no value in printing
+                        * anything about this exception.
+                        */
+                       listing_failed = true;
+                       return {};
                }
        }();
 
This page took 0.023957 seconds and 4 git commands to generate.