tool: End status line after pull

Otherwise we potentially get overlapped output.
This commit is contained in:
Colin Walters 2014-04-03 08:04:32 -04:00
parent edc8665206
commit 49d736c265
2 changed files with 17 additions and 2 deletions

View File

@ -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);

View File

@ -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);