[gnome-builder/wip/gtk4-port] plugins/jhbuild: remove use of ide_runtime_create_launcher()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/jhbuild: remove use of ide_runtime_create_launcher()
- Date: Tue, 28 Jun 2022 19:07:49 +0000 (UTC)
commit cf12cbcb118583bfdac7df50e9a1a7030619f4f7
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 28 12:06:55 2022 -0700
plugins/jhbuild: remove use of ide_runtime_create_launcher()
I want to get rid of that API, so start doing run contexts directly.
src/plugins/jhbuild/gbp-jhbuild-runtime.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/jhbuild/gbp-jhbuild-runtime.c b/src/plugins/jhbuild/gbp-jhbuild-runtime.c
index 0ff7a3d14..b636bc473 100644
--- a/src/plugins/jhbuild/gbp-jhbuild-runtime.c
+++ b/src/plugins/jhbuild/gbp-jhbuild-runtime.c
@@ -139,23 +139,26 @@ gbp_jhbuild_runtime_contains_program_in_path (IdeRuntime *runtime,
GCancellable *cancellable)
{
GbpJhbuildRuntime *self = (GbpJhbuildRuntime *)runtime;
- g_autoptr(IdeSubprocessLauncher) launcher = NULL;
+ g_autoptr(IdeRunContext) run_context = NULL;
g_autoptr(IdeSubprocess) subprocess = NULL;
+ g_autoptr(GError) error = NULL;
g_assert (GBP_IS_JHBUILD_RUNTIME (self));
g_assert (program != NULL);
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
- if (!(launcher = ide_runtime_create_launcher (runtime, NULL)))
- return FALSE;
-
- ide_subprocess_launcher_set_flags (launcher,
- (G_SUBPROCESS_FLAGS_STDOUT_SILENCE |
- G_SUBPROCESS_FLAGS_STDERR_SILENCE));
- ide_subprocess_launcher_push_args (launcher, IDE_STRV_INIT ("which", program));
+ run_context = ide_run_context_new ();
+ ide_run_context_push_host (run_context);
+ ide_run_context_push (run_context,
+ gbp_jhbuild_runtime_run_handler,
+ g_object_ref (self),
+ g_object_unref);
- if (!(subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, NULL)))
- return FALSE;
+ if (!(subprocess = ide_run_context_spawn (run_context, &error)))
+ {
+ g_warning ("Failed to spawn subprocess: %s", error->message);
+ return FALSE;
+ }
return ide_subprocess_wait_check (subprocess, cancellable, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]