Bloux
Bloux

Reputation: 83

How to start a process in a non blocking mode, and know when it finished

I am using C++ and Qt 5.15 for my application. Inside my code, I would like at some point to run a docker image to perform some actions, and then do postprocessing on the results. It is important that, while my docker container is running, the application also keeps running and is not blocked by the docker run command.

I tried to use QProcess::startDetached and connect the finished() signal to my postprocessing function. However startDetached is static and does not emit any signal so it does not work.
Using start and waitForFinished(-1) is blocking for the rest of the program.
Not using waitForFinished destroys the QProcess instance before completion of the docker run. I feel like I am running out of options and do not know how to solve my problem.

Any ideas on what could I do ?
Thanks!

Upvotes: 0

Views: 69

Answers (0)

Related Questions