From 69f6c88d58365e044396fc7c1e67e52a14fff31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 2 Aug 2007 17:21:12 +0000 Subject: [PATCH] * The PtyReader thread now just exits when there is no more left to be read. * setpgid() when spawning the shell was superfluous, as we're already the session leader. * Added a comment to TermView::NotifyQuit() about why sending B_QUIT_REQUESTED to the window isn't such a good idea when you have more than one use for it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21794 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/Shell.cpp | 17 ++--------------- src/apps/terminal/SmartTabView.h | 1 - src/apps/terminal/TermParse.cpp | 5 +---- src/apps/terminal/TermView.cpp | 3 ++- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp index 97906875cf..6367ef2524 100644 --- a/src/apps/terminal/Shell.cpp +++ b/src/apps/terminal/Shell.cpp @@ -345,7 +345,6 @@ Shell::_Spawn(int row, int col, const char *command, const char *encoding) return B_ERROR; } - handshake_t handshake; if (fProcessID == 0) { @@ -489,20 +488,8 @@ Shell::_Spawn(int row, int col, const char *command, const char *encoding) ioctl(0, TIOCSWINSZ, &ws); - /* - * Set process group ID to process, and Terminal Process group ID - * to this process group ID (equal process ID). - */ - - pid_t processGroup = getpid(); - if (setpgid(processGroup, processGroup) < 0) { - handshake.status = PTY_NG; - snprintf(handshake.msg, sizeof(handshake.msg), - "can't set process group id."); - send_handshake_message(terminalThread, handshake); - exit(1); - } - tcsetpgrp(0, processGroup); + tcsetpgrp(0, getpgrp()); + // set this process group ID as the controlling terminal /* pty open and set termios successful. */ handshake.status = PTY_OK; diff --git a/src/apps/terminal/SmartTabView.h b/src/apps/terminal/SmartTabView.h index 974f06b615..150ad55d29 100644 --- a/src/apps/terminal/SmartTabView.h +++ b/src/apps/terminal/SmartTabView.h @@ -5,7 +5,6 @@ * Authors: * Stefano Ceccherini (burton666@libero.it) */ - #ifndef __SMARTTABVIEW_H #define __SMARTTABVIEW_H diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp index a3518849e1..a844436468 100644 --- a/src/apps/terminal/TermParse.cpp +++ b/src/apps/terminal/TermParse.cpp @@ -258,10 +258,7 @@ TermParse::PtyReader() int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition)); if (nread <= 0) { fView->NotifyQuit(errno); - // on the next iteration, fQuitting will probably be true, - // or the semaphore acquisition will fail, so this thread will - // be killed anyway. - continue; + return B_OK; } // Copy read string to PtyBuffer. diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 11cdcc1b45..54b76cc7e1 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -2454,7 +2454,8 @@ void TermView::NotifyQuit(int32 reason) { // TODO: If we are a replicant, we can't just quit the BWindow, no?. - Window()->PostMessage(B_QUIT_REQUESTED); + // Exactly, and the same is true for tabs! + Window()->PostMessage(B_QUIT_REQUESTED); }