summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2011-07-23 14:49:51 -0700
committerDaniel Burrows <dburrows@debian.org>2011-07-23 14:49:51 -0700
commita4a9d17257679ba8a8233a453f4b6b007518e14d (patch)
treef409548be896344d606b328030c2b73ec28a86c6
parentbd820a6b063c1fcd34e82554bb24296800223621 (diff)
downloadaptitude-a4a9d17257679ba8a8233a453f4b6b007518e14d.tar.gz
Hopefully fix the use of VTE in the GTK+ frontend.
I'm not sure that it's cleaned up correctly right now; need to double back and check this later on.
-rw-r--r--src/gtk/dpkg_terminal.cc32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/gtk/dpkg_terminal.cc b/src/gtk/dpkg_terminal.cc
index 8d3f0c46..faca204a 100644
--- a/src/gtk/dpkg_terminal.cc
+++ b/src/gtk/dpkg_terminal.cc
@@ -1,6 +1,6 @@
// dpkg_terminal.cc
//
-// Copyright 2008-2010 Daniel Burrows
+// Copyright 2008-2011 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -500,7 +500,6 @@ namespace gui
LOG_INFO(logger, "Child process starting.");
-
// We have to do this before tcsetattr(), because tcsetattr()
// requires the terminal (that's the parent process) to respond,
// but that process is blocked in accept() until we open the side
@@ -593,6 +592,8 @@ namespace gui
try
{
+ // TODO: now that I control the fork() call, I can probably
+ // use pipes instead of a socket.
listen_sock = std::auto_ptr<temporary_listen_socket>(new temporary_listen_socket(dpkg_socket_name, 1));
}
catch(TemporarySocketFail &ex)
@@ -604,12 +605,31 @@ namespace gui
}
GtkWidget *vte = terminal->gobj();
- pid_t pid = vte_terminal_forkpty(VTE_TERMINAL(vte),
- NULL, NULL,
- FALSE, FALSE, FALSE);
+ GError *error = NULL;
+ VtePty *pty = vte_terminal_pty_new(VTE_TERMINAL(vte),
+ static_cast<VtePtyFlags>(VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP),
+ &error);
+
+ if(error != NULL)
+ {
+ // Couldn't create a pty ... what to do now? Can't run dpkg
+ // without a pty, so abort.
+ LOG_ERROR(logger, "Unable to create a pty: " << error->message);
+ _error->Error("Unable to create a pty: %s", error->message);
+
+ if(pty != NULL)
+ g_free(pty);
+
+ return;
+ }
+
+ pid_t pid = fork();
if(pid == 0)
- child_process(dpkg_socket_name, f);
+ {
+ vte_pty_child_setup(pty);
+ child_process(dpkg_socket_name, f);
+ }
else
{
LOG_INFO(logger, "The shell process is PID " << pid << ".");