Fix: add error/msg output to save command
authorDavid Goulet <dgoulet@efficios.com>
Wed, 12 Mar 2014 21:08:32 +0000 (17:08 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 12 Mar 2014 21:08:32 +0000 (17:08 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/save.c

index e7c3caeefb2e6dce8de041c7bf4e9c73e6888628..e8a4565e9d692492787694f502b5279da8d6c059 100644 (file)
@@ -117,18 +117,27 @@ int cmd_save(int argc, const char **argv)
                goto end_destroy;
        }
 
-       if (lttng_save_session_attr_set_output_url(attr,
-               opt_output_path)) {
+       if (lttng_save_session_attr_set_output_url(attr, opt_output_path)) {
                ret = CMD_ERROR;
                goto end_destroy;
        }
 
        ret = lttng_save_session(attr);
-       if (ret) {
-               if (ret == -LTTNG_ERR_SESS_NOT_FOUND) {
-                       ERR("Session '%s' not found", session_name);
+       if (ret < 0) {
+               ERR("%s", lttng_strerror(ret));
+       } else {
+               /* Inform the user of what just happened on success. */
+               if (session_name && opt_output_path) {
+                       MSG("Session %s saved successfully in %s.", session_name,
+                                       opt_output_path);
+               } else if (session_name && !opt_output_path) {
+                       MSG("Session %s saved successfully.", session_name);
+               } else if (!session_name && opt_output_path) {
+                       MSG("All sessions have been saved successfully in %s.",
+                                       opt_output_path);
+               } else {
+                       MSG("All sessions have been saved successfully.");
                }
-               ret = CMD_ERROR;
        }
 end_destroy:
        lttng_save_session_attr_destroy(attr);
This page took 0.025588 seconds and 4 git commands to generate.