summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-15 01:14:17 (UTC)
committer zecke <zecke>2002-10-15 01:14:17 (UTC)
commite0efd37513192d9a17fa9a9f46bbaed0ca38029c (patch) (unidiff)
tree04163d93fc4c4185d322912e9430eff9b36b71cc
parentb12b38a00c66ddc100f3fff75478539b8b797928 (diff)
downloadopie-e0efd37513192d9a17fa9a9f46bbaed0ca38029c.zip
opie-e0efd37513192d9a17fa9a9f46bbaed0ca38029c.tar.gz
opie-e0efd37513192d9a17fa9a9f46bbaed0ca38029c.tar.bz2
The right way to deal with the pipe
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp10
-rw-r--r--noncore/apps/opie-console/MyPty.h2
2 files changed, 9 insertions, 3 deletions
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
@@ -115,9 +115,11 @@ void MyPty::donePty()
115 115
116 if (m_cpid) { 116 if (m_cpid) {
117 qWarning("killing!!!"); 117 qWarning("killing!!!");
118 kill(m_cpid, SIGHUP); 118 kill(m_cpid, SIGHUP);
119 waitpid(m_cpid, &status, 0); 119 //waitpid(m_cpid, &status, 0);
120 delete m_sn_e;
121 m_sn_e = 0l;
120 } 122 }
121 123
122 m_cpid = 0; 124 m_cpid = 0;
123// emit done(status); 125// emit done(status);
@@ -185,11 +187,12 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
185 } 187 }
186 188
187 // parent - continue as a widget 189 // parent - continue as a widget
188 QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); 190 QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this);
189// QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); 191 delete m_sn_e;
192 m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this);
190 connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); 193 connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty()));
191// connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); 194 connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error()));
192 195
193 return 0; 196 return 0;
194} 197}
195 198
@@ -231,8 +234,9 @@ int MyPty::openPty()
231 Create an instance. 234 Create an instance.
232*/ 235*/
233MyPty::MyPty(const Profile&) : m_cpid(0) 236MyPty::MyPty(const Profile&) : m_cpid(0)
234{ 237{
238 m_sn_e = 0l;
235 m_fd = openPty(); 239 m_fd = openPty();
236 ProcCtl* ctl = ProcCtl::self(); 240 ProcCtl* ctl = ProcCtl::self();
237} 241}
238 242
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
@@ -27,8 +27,9 @@
27 27
28#include "io_layer.h" 28#include "io_layer.h"
29 29
30class Profile; 30class Profile;
31class QSocketNotifier;
31class MyPty : public IOLayer 32class MyPty : public IOLayer
32{ 33{
33 Q_OBJECT 34 Q_OBJECT
34public: 35public:
@@ -89,7 +90,8 @@ private:
89 char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx" 90 char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx"
90 char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." 91 char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..."
91 int m_fd; 92 int m_fd;
92 int m_cpid; 93 int m_cpid;
94 QSocketNotifier* m_sn_e;
93}; 95};
94 96
95#endif 97#endif