summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp22
-rw-r--r--noncore/apps/opie-console/procctl.cpp2
2 files changed, 18 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 10828b0..cacb4ce 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -83,4 +83,5 @@
83#endif 83#endif
84 84
85#include "procctl.h"
85#include "MyPty.h" 86#include "MyPty.h"
86 87
@@ -114,9 +115,11 @@ void MyPty::donePty()
114 115
115 if (m_cpid) { 116 if (m_cpid) {
117 qWarning("killing!!!");
116 kill(m_cpid, SIGHUP); 118 kill(m_cpid, SIGHUP);
117 waitpid(m_cpid, &status, 0); 119 waitpid(m_cpid, &status, 0);
118 } 120 }
119 121
120 emit done(status); 122 m_cpid = 0;
123// emit done(status);
121} 124}
122 125
@@ -130,4 +133,5 @@ const char* MyPty::deviceName()
130void MyPty::error() 133void MyPty::error()
131{ 134{
135 qWarning("error");
132 // This is code from the Qt DumbTerminal example 136 // This is code from the Qt DumbTerminal example
133 donePty(); 137 donePty();
@@ -183,7 +187,7 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
183 // parent - continue as a widget 187 // parent - continue as a widget
184 QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); 188 QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this);
185 QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); 189// QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this);
186 connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); 190 connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty()));
187 connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); 191// connect(sn_e,SIGNAL(activated(int)),this,SLOT(error()));
188 192
189 return 0; 193 return 0;
@@ -230,4 +234,5 @@ MyPty::MyPty(const Profile&) : m_cpid(0)
230{ 234{
231 m_fd = openPty(); 235 m_fd = openPty();
236 ProcCtl* ctl = ProcCtl::self();
232} 237}
233 238
@@ -260,5 +265,5 @@ void MyPty::reload( const Profile& ) {
260void MyPty::send(const QByteArray& ar) 265void MyPty::send(const QByteArray& ar)
261{ 266{
262 267 qWarning("sending!");
263#ifdef VERBOSE_DEBUG 268#ifdef VERBOSE_DEBUG
264 // verbose debug 269 // verbose debug
@@ -275,14 +280,21 @@ void MyPty::send(const QByteArray& ar)
275void MyPty::readPty() 280void MyPty::readPty()
276{ 281{
282 qWarning("read");
277 QByteArray buf(4096); 283 QByteArray buf(4096);
278 284
279 int len = ::read( m_fd, buf.data(), 4096 ); 285 int len = ::read( m_fd, buf.data(), 4096 );
280 286
281 if (len == -1) 287 if (len == -1 || len == 0) {
288 qWarning("donePty!!! now!");
282 donePty(); 289 donePty();
290 qWarning("return %s", sender()->className() );
291 delete sender();
292 return;
293 }
283 294
284 if (len < 0) 295 if (len < 0)
285 return; 296 return;
286 297
298
287 buf.resize(len); 299 buf.resize(len);
288 emit received(buf); 300 emit received(buf);
diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp
index b0b6846..d1cfaf6 100644
--- a/noncore/apps/opie-console/procctl.cpp
+++ b/noncore/apps/opie-console/procctl.cpp
@@ -72,5 +72,5 @@ int ProcCtl::status(pid_t pid )const{
72} 72}
73void ProcCtl::signal_handler(int) { 73void ProcCtl::signal_handler(int) {
74 qWarning("signal handler"); 74 qWarning("signal handler in ProcCtl");
75 int status; 75 int status;
76 signal( SIGCHLD, signal_handler ); 76 signal( SIGCHLD, signal_handler );