Unsolved Qthread
-
i am running Qprocess in Qthread it is not executing can any body tell what is happening .Below is my code .
This code is in thread
QProcess *process = new QProcess();
process->start("sh",QStringList() << "du");
process->waitForFinished(); -
@satyanarayana143
Forget about threads. (I don't know if you even need a thread,QProcess
running is asynchronous, you probably do not need any thread, but that's another matter.)process->start("sh",QStringList() << "du");
I don't know what you expect this to do, but there is a fair chance it is incorrect. You should test exactly this command in a terminal and see what you get. In code you must read from standard error at minimum after trying to execute a command because 90% of the time people say "my command is not working" it turns out a message is being output there. See e.g. https://doc.qt.io/qt-5/qprocess.html#readAllStandardError. You should also always slot onto https://doc.qt.io/qt-5/qprocess.html#errorOccurred.