From e0efd37513192d9a17fa9a9f46bbaed0ca38029c Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 15 Oct 2002 01:14:17 +0000 Subject: The right way to deal with the pipe --- diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index cacb4ce..ae01392 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp @@ -116,7 +116,9 @@ void MyPty::donePty() if (m_cpid) { qWarning("killing!!!"); kill(m_cpid, SIGHUP); - waitpid(m_cpid, &status, 0); + //waitpid(m_cpid, &status, 0); + delete m_sn_e; + m_sn_e = 0l; } m_cpid = 0; @@ -186,9 +188,10 @@ 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); + delete m_sn_e; + m_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(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); return 0; } @@ -232,6 +235,7 @@ int MyPty::openPty() */ MyPty::MyPty(const Profile&) : m_cpid(0) { + m_sn_e = 0l; m_fd = openPty(); ProcCtl* ctl = ProcCtl::self(); } diff --git a/noncore/apps/opie-console/MyPty.h b/noncore/apps/opie-console/MyPty.h index 9231a8a..3166fa0 100644 --- a/noncore/apps/opie-console/MyPty.h +++ b/noncore/apps/opie-console/MyPty.h @@ -28,6 +28,7 @@ #include "io_layer.h" class Profile; +class QSocketNotifier; class MyPty : public IOLayer { Q_OBJECT @@ -90,6 +91,7 @@ private: char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." int m_fd; int m_cpid; + QSocketNotifier* m_sn_e; }; #endif -- cgit v0.9.0.2