[gnome-builder/gnome-builder-3-32] foundry: use child-side of PTY device
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-32] foundry: use child-side of PTY device
- Date: Fri, 26 Apr 2019 21:40:22 +0000 (UTC)
commit b7b3a90ffa58d1d1843ddbd9d226f8a9ad4b0f4b
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 26 14:39:56 2019 -0700
foundry: use child-side of PTY device
We were previously using the master side of the deivce, which means we'd
get blocked eventually (as nothing was reading from it). Instead we need
to treat this like another child process and give it that side of the PTY.
Fixes #895
src/libide/foundry/ide-runner.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/foundry/ide-runner.c b/src/libide/foundry/ide-runner.c
index c9b48c0e6..58454a1ac 100644
--- a/src/libide/foundry/ide-runner.c
+++ b/src/libide/foundry/ide-runner.c
@@ -25,6 +25,7 @@
#include <dazzle.h>
#include <errno.h>
#include <glib/gi18n.h>
+#include <libide-io.h>
#include <libide-threading.h>
#include <libpeas/peas.h>
#include <stdlib.h>
@@ -1220,15 +1221,23 @@ void
ide_runner_set_pty (IdeRunner *self,
VtePty *pty)
{
- int fd = -1;
+ int child_fd = -1;
g_return_if_fail (IDE_IS_RUNNER (self));
g_return_if_fail (!pty || VTE_IS_PTY (pty));
if (pty != NULL)
- fd = vte_pty_get_fd (pty);
+ {
+ int parent_fd = vte_pty_get_fd (pty);
+
+ if (parent_fd != -1)
+ child_fd = ide_pty_intercept_create_slave (parent_fd, TRUE);
+ }
+
+ ide_runner_set_tty (self, child_fd);
- ide_runner_set_tty (self, fd);
+ if (child_fd != -1)
+ close (child_fd);
}
static gint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]