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; gs_unref_object OstreeAsyncProgress *progress = NULL;
gboolean changed; gboolean changed;
GSConsole *console = NULL; GSConsole *console = NULL;
gboolean in_status_line = FALSE;
GKeyFile *old_origin; GKeyFile *old_origin;
GKeyFile *new_origin = NULL; 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); 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, if (!ostree_sysroot_upgrader_pull (upgrader, 0, 0, progress, &changed,
cancellable, error)) cancellable, error))
goto out; goto out;
@ -145,7 +152,7 @@ ot_admin_builtin_switch (int argc, char **argv, OstreeSysroot *sysroot, GCancell
ret = TRUE; ret = TRUE;
out: out:
if (console) if (in_status_line)
gs_console_end_status_line (console, NULL, NULL); gs_console_end_status_line (console, NULL, NULL);
if (new_origin) if (new_origin)
g_key_file_unref (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 *merge_deployment = NULL;
gs_unref_object OstreeDeployment *new_deployment = NULL; gs_unref_object OstreeDeployment *new_deployment = NULL;
GSConsole *console = NULL; GSConsole *console = NULL;
gboolean in_status_line = FALSE;
gs_unref_object OstreeAsyncProgress *progress = NULL; gs_unref_object OstreeAsyncProgress *progress = NULL;
gboolean changed; gboolean changed;
OstreeSysrootUpgraderPullFlags upgraderpullflags = 0; OstreeSysrootUpgraderPullFlags upgraderpullflags = 0;
@ -81,6 +82,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
if (console) if (console)
{ {
gs_console_begin_status_line (console, "", NULL, NULL); gs_console_begin_status_line (console, "", NULL, NULL);
in_status_line = TRUE;
progress = ostree_async_progress_new_and_connect (ot_common_pull_progress, console); 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)) cancellable, error))
goto out; goto out;
if (in_status_line)
{
gs_console_end_status_line (console, NULL, NULL);
in_status_line = FALSE;
}
if (!changed) if (!changed)
{ {
g_print ("No update available.\n"); g_print ("No update available.\n");
@ -113,7 +121,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
ret = TRUE; ret = TRUE;
out: out:
if (console) if (in_status_line)
gs_console_end_status_line (console, NULL, NULL); gs_console_end_status_line (console, NULL, NULL);
if (context) if (context)
g_option_context_free (context); g_option_context_free (context);