[ostree] Port ostree-pull to GSConsole
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] Port ostree-pull to GSConsole
- Date: Thu, 24 Jan 2013 20:22:59 +0000 (UTC)
commit 6fde0b61a8987c93d6177d5163a5ef4144d47b56
Author: Colin Walters <walters verbum org>
Date: Thu Jan 24 15:22:16 2013 -0500
Port ostree-pull to GSConsole
As part of this, we need to ensure our streams are inherited across
the chain of child processes.
src/libgsystem | 2 +-
src/ostree/ostree-pull.c | 18 ++++++++++--------
src/ostree/ot-admin-builtin-install.c | 8 ++++----
src/ostree/ot-admin-builtin-prune.c | 2 +-
src/ostree/ot-admin-builtin-pull-deploy.c | 4 ++--
src/ostree/ot-admin-builtin-upgrade.c | 4 ++--
6 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/src/libgsystem b/src/libgsystem
index 43a525f..87bf968 160000
--- a/src/libgsystem
+++ b/src/libgsystem
@@ -1 +1 @@
-Subproject commit 43a525fd40faf7dfd261bf3d7469f642a68fad68
+Subproject commit 87bf968f3470657e5a80d3f937b2142f9f6fb53b
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index f7fbf37..ff123d5 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -118,7 +118,6 @@ typedef struct {
GError **async_error;
gboolean caught_error;
- gboolean stdout_is_tty;
guint last_padding;
} OtPullData;
@@ -238,7 +237,8 @@ uri_fetch_update_status (gpointer user_data)
diff--;
}
}
- g_print ("%c8%s", 0x1B, status->str);
+
+ gs_console_begin_status_line (gs_console_get (), status->str, NULL, NULL);
g_string_free (status, TRUE);
@@ -289,10 +289,14 @@ static gboolean
run_mainloop_monitor_fetcher (OtPullData *pull_data)
{
GSource *update_timeout = NULL;
+ GSConsole *console;
+
+ console = gs_console_get ();
- if (pull_data->stdout_is_tty)
+ if (console)
{
- g_print ("%c7", 0x1B);
+ gs_console_begin_status_line (console, "", NULL, NULL);
+
update_timeout = g_timeout_source_new_seconds (1);
g_source_set_callback (update_timeout, uri_fetch_update_status, pull_data, NULL);
g_source_attach (update_timeout, g_main_loop_get_context (pull_data->loop));
@@ -301,9 +305,9 @@ run_mainloop_monitor_fetcher (OtPullData *pull_data)
g_main_loop_run (pull_data->loop);
- if (pull_data->stdout_is_tty)
+ if (console)
{
- g_print ("\n");
+ gs_console_end_status_line (console, NULL, NULL);
g_source_destroy (update_timeout);
}
@@ -1232,8 +1236,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
start_time = g_get_monotonic_time ();
- pull_data->stdout_is_tty = isatty (1);
-
pull_data->remote_name = g_strdup (argv[1]);
pull_data->fetcher = ostree_fetcher_new (ostree_repo_get_tmpdir (pull_data->repo));
config = ostree_repo_get_config (repo);
diff --git a/src/ostree/ot-admin-builtin-install.c b/src/ostree/ot-admin-builtin-install.c
index 23ff6ad..06249a9 100644
--- a/src/ostree/ot-admin-builtin-install.c
+++ b/src/ostree/ot-admin-builtin-install.c
@@ -134,7 +134,7 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
NULL);
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "admin", ostree_dir_arg, "os-init", osname, NULL))
goto out;
@@ -172,7 +172,7 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
goto out;
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", repoarg, "remote", "add",
osname, repourl, tree_to_deploy, NULL))
@@ -180,13 +180,13 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
}
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "pull", repoarg, osname, NULL))
goto out;
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "admin", ostree_dir_arg, "deploy", osname,
tree_to_deploy, NULL))
diff --git a/src/ostree/ot-admin-builtin-prune.c b/src/ostree/ot-admin-builtin-prune.c
index f53229c..2a3c42f 100644
--- a/src/ostree/ot-admin-builtin-prune.c
+++ b/src/ostree/ot-admin-builtin-prune.c
@@ -171,7 +171,7 @@ ot_admin_builtin_prune (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, G
repo_arg = g_strconcat ("--repo=", gs_file_get_path_cached (repo_path), NULL);
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", repo_arg, "prune", "--refs-only",
"--depth=0", NULL))
diff --git a/src/ostree/ot-admin-builtin-pull-deploy.c b/src/ostree/ot-admin-builtin-pull-deploy.c
index 2fd3cd4..6bfa4aa 100644
--- a/src/ostree/ot-admin-builtin-pull-deploy.c
+++ b/src/ostree/ot-admin-builtin-pull-deploy.c
@@ -106,7 +106,7 @@ ot_admin_builtin_pull_deploy (int argc, char **argv, OtAdminBuiltinOpts *admin_o
NULL);
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "pull", repo_arg, osname, NULL))
goto out;
@@ -120,7 +120,7 @@ ot_admin_builtin_pull_deploy (int argc, char **argv, OtAdminBuiltinOpts *admin_o
gs_file_get_path_cached (admin_opts->boot_dir),
NULL);
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "admin", opt_ostree_dir_arg, opt_boot_dir_arg, "deploy", osname,
deploy_name, NULL))
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index dc28657..f8ee8a0 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -63,13 +63,13 @@ ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
NULL);
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "admin", ostree_dir_arg, "pull-deploy", osname, NULL))
goto out;
if (!gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
- GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
+ GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", "admin", ostree_dir_arg, "prune", osname, NULL))
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]