Originally Posted by
wysota
Each process has its own set of standard output channels. They are not inherited within the process group. Thus, as already said, your intermediate process would need to catch and forward output of the final process.
Thnks by the reply and Ok, so the question is how could catch the std output, this is the code that i use:
I have a class MCompiler : public QProcess
MCompiler::MCompiler( )
{
mCompiler = tr( "MCompiler" );
QProcessEnvironment pEnv = QProcessEnvironment::systemEnvironment();
pEnv.insert( "TMPDIR", SSPATH );
setProcessEnvironment( pEnv );
connect( this, SIGNAL( readyReadStandardOutput( ) ), this, SLOT( compileResult( ) ) );
}
MCompiler::MCompiler( )
{
mCompiler = tr( "MCompiler" );
QProcessEnvironment pEnv = QProcessEnvironment::systemEnvironment();
pEnv.insert( "TMPDIR", SSPATH );
setProcessEnvironment( pEnv );
connect( this, SIGNAL( readyReadStandardOutput( ) ), this, SLOT( compileResult( ) ) );
}
To copy to clipboard, switch view to plain text mode
here is the code when start my compiler
void MCompiler
::compile( QString fileFullPath
) {
argv << fileFullPath;
start( mCompiler, argv );
waitForFinished();
}
void MCompiler::compile( QString fileFullPath )
{
QStringList argv;
argv << fileFullPath;
start( mCompiler, argv );
waitForFinished();
}
To copy to clipboard, switch view to plain text mode
and i have the signal connected to the slot for read the stdOutput
void SGWMLSCompiler::compileResult()
{
qDebug() << line;
}
}
void SGWMLSCompiler::compileResult()
{
QByteArray bytes = readAllStandardError();
QStringList lines = QString(bytes).split("\n");
foreach (QString line, lines) {
qDebug() << line;
}
}
To copy to clipboard, switch view to plain text mode
And here is where i just get the last std output for Compiler.
Bookmarks