[ostree] tool: End status line after pull



commit 49d736c26549b2b23af13a9e0d15432c7a97e59b
Author: Colin Walters <walters verbum org>
Date:   Thu Apr 3 08:04:32 2014 -0400

    tool: End status line after pull
    
    Otherwise we potentially get overlapped output.

 src/ostree/ot-admin-builtin-switch.c  |    9 ++++++++-
 src/ostree/ot-admin-builtin-upgrade.c |   10 +++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c
index 6884d9f..ad65263 100644
--- a/src/ostree/ot-admin-builtin-switch.c
+++ b/src/ostree/ot-admin-builtin-switch.c
@@ -59,6 +59,7 @@ ot_admin_builtin_switch (int argc, char **argv, OstreeSysroot *sysroot, GCancell
   gs_unref_object OstreeAsyncProgress *progress = NULL;
   gboolean changed;
   GSConsole *console = NULL;
+  gboolean in_status_line = FALSE;
   GKeyFile *old_origin;
   GKeyFile *new_origin = NULL;
 
@@ -113,6 +114,12 @@ ot_admin_builtin_switch (int argc, char **argv, OstreeSysroot *sysroot, GCancell
       progress = ostree_async_progress_new_and_connect (ot_common_pull_progress, console);
     }
 
+  if (in_status_line)
+    {
+      gs_console_end_status_line (console, NULL, NULL);
+      in_status_line = FALSE;
+    }
+
   if (!ostree_sysroot_upgrader_pull (upgrader, 0, 0, progress, &changed,
                                      cancellable, error))
     goto out;
@@ -145,7 +152,7 @@ ot_admin_builtin_switch (int argc, char **argv, OstreeSysroot *sysroot, GCancell
 
   ret = TRUE;
  out:
-  if (console)
+  if (in_status_line)
     gs_console_end_status_line (console, NULL, NULL);
   if (new_origin)
     g_key_file_unref (new_origin);
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index 8d0c7cc..46acfbc 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -59,6 +59,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
   gs_unref_object OstreeDeployment *merge_deployment = NULL;
   gs_unref_object OstreeDeployment *new_deployment = NULL;
   GSConsole *console = NULL;
+  gboolean in_status_line = FALSE;
   gs_unref_object OstreeAsyncProgress *progress = NULL;
   gboolean changed;
   OstreeSysrootUpgraderPullFlags upgraderpullflags = 0;
@@ -81,6 +82,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
   if (console)
     {
       gs_console_begin_status_line (console, "", NULL, NULL);
+      in_status_line = TRUE;
       progress = ostree_async_progress_new_and_connect (ot_common_pull_progress, console);
     }
 
@@ -92,6 +94,12 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
                                      cancellable, error))
     goto out;
 
+  if (in_status_line)
+    {
+      gs_console_end_status_line (console, NULL, NULL);
+      in_status_line = FALSE;
+    }
+
   if (!changed)
     {
       g_print ("No update available.\n");
@@ -113,7 +121,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
 
   ret = TRUE;
  out:
-  if (console)
+  if (in_status_line)
     gs_console_end_status_line (console, NULL, NULL);
   if (context)
     g_option_context_free (context);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]