No SIGNAL from startDetached ?
-
Contrary to the documentation the attached code produces desired results, but appears to emit no SIGNALs - I was expecting at least "started'.
Is is codded correctly ?OProcess.startDetached(Command); OProcess.waitForFinished();
qDebug(" START int Form::RunProcess_Asynch(QString Commnd)"); qDebug() << Command; // TODO Add connect HERE ClearTempFile(); QProcess OProcess; connect(&OProcess, &QProcess::errorOccurred, this, &Form::processError); //connect(&OProcess, &QProcess::finished(exit)::finished, this, &Form::processFinished); // connect(&OProcess, &QProcess::started, this, &Form::processError); connect(&OProcess, &QProcess::started, this, &Form::processStarted); // capture any errors (do this before you run the process) connect(&OProcess, &QProcess::errorOccurred, this, &Form::processError); OProcess.startDetached(Command); OProcess.waitForFinished(); qDebug("END int Form::RunProcess_Asynch(QString Commnd)");
-
@AnneRanch said in No SIGNAL from startDetached ?:
I was expecting at least "started'.
This is wrong - otherwise it would not have been called 'detached'
The documentation is also very clear about it: "Starts the program set by setProgram() with arguments set by setArguments() in a new process, and detaches from it." -
@AnneRanch
I took the time over at https://forum.qt.io/topic/133498/cannot-get-the-qprocess-started/17 to test and explain that theprocess.startDetached("hcitool dev>>/tmp/temp")
which you believe is working for you is actually not, and is no different from usingstart()
here which also won't work on that string. Did you read it?