PDA

View Full Version : process not emiting any signals



PHANI
7th February 2012, 04:31
hi, some one please tell me ..i am trying to executing some commands through QProcess some commands are executing properly they are emiting appropriate readyreadstandardoutput and error signals but few commands not emitting any signals...please tell me what's the problem...i am executing this in unix

ChrisW67
7th February 2012, 04:55
The problem is your code. How do you think we can help without seeing your code or knowing anything about the processes that work/don't work?

Perhaps those processes do not output anything to the stdout or stderr streams. Perhaps the executable cannot be found to execute or is not an executable. Are you connecting the error() or finished() signal? Are you looking at the exitCode() and/or exitState()?

PHANI
7th February 2012, 08:59
SORRY ,here is my code


costructor
{
proc = new QProcess();
proc->start( "tclsh" );

textEdit->addAction( actionClear_All );
// connects
connect( proc, SIGNAL( readyReadStandardOutput() ), this, SLOT( captureProcessOutput() ));
connect( proc, SIGNAL( readyReadStandardError() ), this, SLOT( captureProcessError() ));

connect( lineEdit, SIGNAL( returnPressed() ), this, SLOT( lineEditReturnPressed() ) );
connect( proc, SIGNAL( finished( int, QProcess::ExitStatus) ), this, SLOT( processFinished(int,QProcess::ExitStatus ) ));

}
void MainWindow::lineEditReturnPressed()
{
proc->write( qPrintable( lineEdit->text()+'\n' ) );
}

void MainWindow::captureProcessOutput()
{
textEdit->append( proc->readAllStandardOutput() );
}
void MainWindow::captureProcessError()
{
textEdit->append( proc->readAllStandardError() );
}
void MainWindow::processFinished( int exitCode, QProcess::ExitStatus )
{ Q_UNUSED( exitCode );
qApp->quit();
}

Rudobrody
7th February 2012, 11:38
Create object and make connection :

proc = new QProcess();
connect( proc, SIGNAL( readyReadStandardOutput() ), this, SLOT( captureProcessOutput() ));
connect( proc, SIGNAL( readyReadStandardError() ), this, SLOT( captureProcessError() ));
connect( proc, SIGNAL( finished( int, QProcess::ExitStatus) ), this, SLOT( processFinished(int,QProcess::ExitStatus ) ));
and start your proc

proc->start( "tclsh" );