Diffstat (limited to 'noncore/apps/opie-console/MyPty.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index b6ae1d9..565d03f 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp @@ -116,12 +116,15 @@ void MyPty::donePty() if (m_cpid) { kill(m_cpid, SIGHUP); //waitpid(m_cpid, &status, 0); delete m_sn_e; + delete m_sn_r; m_sn_e = 0l; + m_sn_r = 0l; } m_cpid = 0; + m_fd = -1; // emit done(status); } @@ -184,12 +187,13 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) exit(-1); } // parent - continue as a widget - QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); + delete m_sn_r; + m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,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(m_sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); return 0; } @@ -220,9 +224,9 @@ int MyPty::openPty() } #endif if ( ptyfd < 0 ) { - qApp->exit(1); +// qApp->exit(1); return -1; } return ptyfd; @@ -233,8 +237,9 @@ int MyPty::openPty() */ MyPty::MyPty(const Profile&) : m_cpid(0) { m_sn_e = 0l; + m_sn_r = 0l; m_fd = openPty(); ProcCtl* ctl = ProcCtl::self(); } @@ -253,13 +258,17 @@ QString MyPty::identifier()const { QString MyPty::name()const{ return identifier(); } bool MyPty::open() { + if (m_fd < 0) + m_fd = openPty(); + start(); return true; } void MyPty::close() { donePty(); + m_fd = openPty(); } void MyPty::reload( const Profile& ) { } @@ -285,9 +294,8 @@ void MyPty::readPty() int len = ::read( m_fd, buf.data(), 4096 ); if (len == -1 || len == 0) { donePty(); - delete sender(); return; } if (len < 0) @@ -305,5 +313,12 @@ void MyPty::readPty() printf("\n"); #endif } +QBitArray MyPty::supports()const { + QBitArray ar(3); + ar[0] = 1; + ar[1] = 0; + ar[2] = 0; + return ar; +} |