示例#1
0
/*!
    start the client program.
*/
int TEPty::run(const char *_pgm, QStrList &_args, const char *_term, ulong winid, bool _addutmp, const char *_konsole_dcop,
               const char *_konsole_dcop_session)
{
    clearArguments();

    setBinaryExecutable(_pgm);

    QStrListIterator it(_args);
    for(; it.current(); ++it)
        arguments.append(it.current());

    if(_term && _term[0])
        setEnvironment("TERM", _term);
    if(_konsole_dcop && _konsole_dcop[0])
        setEnvironment("KONSOLE_DCOP", _konsole_dcop);
    if(_konsole_dcop_session && _konsole_dcop_session[0])
        setEnvironment("KONSOLE_DCOP_SESSION", _konsole_dcop_session);
    setEnvironment("WINDOWID", QString::number(winid));

    setUsePty(All, _addutmp);

    if(start(NotifyOnExit, (Communication)(Stdin | Stdout)) == false)
        return -1;

    resume(); // Start...
    return 0;
}
示例#2
0
void KProcIO::resetAll()
{
    if(isRunning())
        kill();

    clearArguments();
    rbi = 0;
    readsignalon = writeready = true;

    disconnect(this, SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(received(KProcess *, char *, int)));

    disconnect(this, SIGNAL(receivedStderr(KProcess *, char *, int)), this, SLOT(received(KProcess *, char *, int)));

    disconnect(this, SIGNAL(wroteStdin(KProcess *)), this, SLOT(sent(KProcess *)));

    outbuffer.clear();
}
示例#3
0
MyProcess::MyProcess(QObject * parent) : QProcess(parent)
{
	clearArguments();
	setProcessChannelMode( QProcess::MergedChannels );
	
#if USE_TEMP_FILE
	temp_file.open(); // Create temporary file
	QString filename = temp_file.fileName();
	setStandardOutputFile( filename );
	temp_file.close();

	connect(&timer, SIGNAL(timeout()), this, SLOT(readTmpFile()) );
#else
	connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(readStdOut()) );
#endif

	connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), 
            this, SLOT(procFinished()) ); 

}
示例#4
0
MyProcess::MyProcess(QObject * parent) : QProcess(parent)
{
	clearArguments();
	setProcessChannelMode( QProcess::MergedChannels );
	
#if USE_TEMP_FILE
	temp_file.open(); // Create temporary file
	QString filename = temp_file.fileName();
	setStandardOutputFile( filename );
	qDebug("MyProcess::MyProcess: temporary file: %s", filename.toUtf8().data());
	temp_file.close();

	//connect(&temp_file, SIGNAL(readyRead()), this, SLOT(readTmpFile()) );
	connect(&timer, SIGNAL(timeout()), this, SLOT(readTmpFile()) );
#else
	connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(readStdOut()) );
#endif

	connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), 
            this, SLOT(procFinished()) ); 

	// Test splitArguments
	//QStringList l = MyProcess::splitArguments("-opt 1 hello \"56 67\" wssx -ios");
}