pull-local: Output status even in non-tty case
This way I can see progress when running builddisks.
This commit is contained in:
parent
420e5f706a
commit
8521438273
|
|
@ -40,6 +40,7 @@ typedef struct {
|
|||
int n_objects_to_check;
|
||||
volatile int n_objects_checked;
|
||||
volatile int n_objects_copied;
|
||||
GSConsole *console;
|
||||
} OtLocalCloneData;
|
||||
|
||||
static gboolean
|
||||
|
|
@ -141,7 +142,10 @@ idle_print_status (gpointer user_data)
|
|||
g_atomic_int_get (&data->n_objects_checked),
|
||||
data->n_objects_to_check,
|
||||
g_atomic_int_get (&data->n_objects_copied));
|
||||
gs_console_begin_status_line (gs_console_get (), str, NULL, NULL);
|
||||
if (data->console)
|
||||
gs_console_begin_status_line (data->console, str, NULL, NULL);
|
||||
else
|
||||
g_print ("%s\n", str);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -269,26 +273,19 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
|
|||
|
||||
if (data->n_objects_to_check > 0)
|
||||
{
|
||||
console = gs_console_get ();
|
||||
data->console = gs_console_get ();
|
||||
|
||||
if (data->console)
|
||||
gs_console_begin_status_line (console, "", NULL, NULL);
|
||||
|
||||
g_timeout_add_seconds (1, idle_print_status, data);
|
||||
idle_print_status (data);
|
||||
|
||||
if (console)
|
||||
{
|
||||
gs_console_begin_status_line (console, "", NULL, NULL);
|
||||
g_timeout_add_seconds (1, idle_print_status, data);
|
||||
idle_print_status (data);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("Copying %d objects...\n", data->n_objects_to_check);
|
||||
}
|
||||
|
||||
g_main_loop_run (data->loop);
|
||||
|
||||
if (console)
|
||||
{
|
||||
idle_print_status (data);
|
||||
gs_console_end_status_line (console, NULL, NULL);
|
||||
}
|
||||
idle_print_status (data);
|
||||
if (data->console)
|
||||
gs_console_end_status_line (console, NULL, NULL);
|
||||
}
|
||||
|
||||
if (!ostree_repo_commit_transaction (data->dest_repo, NULL, error))
|
||||
|
|
|
|||
Loading…
Reference in New Issue