Using bash with QProcess
Does anyone used QProcess to run bash?
How can i exit the bash process?
I tries bashProcess->write("exit\n\r") but it does'nt seems to work
hi aabc ,
I found this in the QProcess Class Reference :
The finished() signal provides the exit code and exit status of the process as arguments, and you can also call exitCode() to obtain the exit code of the last process that finished, and exitStatus() to obtain its exit status. If an error occurs at any point in time, QProcess will emit the error() signal. You can also call error() to find the type of error that occurred last, and state() to find the current process state.@
I explain it again
My code is:
QProcess* process = new QProcess();
process->write("route > /home/abc/aaa.txt\n\r");
For some reason - the process does not end after the "process->write("exit\n\r");" and the last line does not get called ?
Try removing the '\r' at the end of your lines, only '\n' is needed on linux/unix.
And with that particular code, you could avoid using an intermediate file, by getting the output directly from QProcess:
@QProcess* process = new QProcess();
QString output = process->readAll();@