summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
#endif
+#include "procctl.h"
#include "MyPty.h"
@@ -114,9 +115,11 @@ void MyPty::donePty()
if (m_cpid) {
+ qWarning("killing!!!");
kill(m_cpid, SIGHUP);
waitpid(m_cpid, &status, 0);
}
- emit done(status);
+ m_cpid = 0;
+// emit done(status);
}
@@ -130,4 +133,5 @@ const char* MyPty::deviceName()
void MyPty::error()
{
+ qWarning("error");
// This is code from the Qt DumbTerminal example
donePty();
@@ -183,7 +187,7 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
// parent - continue as a widget
QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this);
- QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this);
+// QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this);
connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty()));
- connect(sn_e,SIGNAL(activated(int)),this,SLOT(error()));
+// connect(sn_e,SIGNAL(activated(int)),this,SLOT(error()));
return 0;
@@ -230,4 +234,5 @@ MyPty::MyPty(const Profile&) : m_cpid(0)
{
m_fd = openPty();
+ ProcCtl* ctl = ProcCtl::self();
}
@@ -260,5 +265,5 @@ void MyPty::reload( const Profile& ) {
void MyPty::send(const QByteArray& ar)
{
-
+ qWarning("sending!");
#ifdef VERBOSE_DEBUG
// verbose debug
@@ -275,14 +280,21 @@ void MyPty::send(const QByteArray& ar)
void MyPty::readPty()
{
+ qWarning("read");
QByteArray buf(4096);
int len = ::read( m_fd, buf.data(), 4096 );
- if (len == -1)
+ if (len == -1 || len == 0) {
+ qWarning("donePty!!! now!");
donePty();
+ qWarning("return %s", sender()->className() );
+ delete sender();
+ return;
+ }
if (len < 0)
return;
+
buf.resize(len);
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{
}
void ProcCtl::signal_handler(int) {
- qWarning("signal handler");
+ qWarning("signal handler in ProcCtl");
int status;
signal( SIGCHLD, signal_handler );