I have 5 QT processes in a slot, which invokes 5 shell scripts on linux system. I have arranged them in a sequential manner but when I had a look at logs, came to know that the processes are not running in a sequential manner. The order of execution gets change
For eg
Qt Code:
  1. void Window::slotProcess(){
  2.  
  3. statusWindow->setText("Running process");
  4.  
  5. /******************* STEP 1: START A NEW PROCESS 1 ***************/
  6. Process_1 = new QProcess(this);
  7. // Connet SIGNAL::STANDARD ERROR with SLOT::UPDATE ERROR, to capture std output
  8. qDebug() << connect(Process_1, SIGNAL(readyReadStandardError()), this, SLOT(UpdateError()));
  9. // Connect SIGNAL::STANDARD OUTPUT with SLOT::UPDATE OUTPUT to capture std error
  10. qDebug() << connect(Process_1, SIGNAL(readyReadStandardOutput()), this, SLOT(UpdateOutput()));
  11. Process_1->start("/home/root/scripts/script_1.sh");
  12.  
  13. /******************* STEP 2: START A NEW PROCESS 2 ***************/
  14. Process_2 = new QProcess(this);
  15. // Connet SIGNAL::STANDARD ERROR with SLOT::UPDATE ERROR, to capture std output
  16. qDebug() << connect(Process_2, SIGNAL(readyReadStandardError()), this, SLOT(UpdateError()));
  17. // Connect SIGNAL::STANDARD OUTPUT with SLOT::UPDATE OUTPUT to capture std error
  18. qDebug() << connect(Process_2, SIGNAL(readyReadStandardOutput()), this, SLOT(UpdateOutput()));
  19. Process_2->start("/home/root/scripts/script_2.sh");
  20.  
  21. .....
To copy to clipboard, switch view to plain text mode 

But when I see debug messages, it shows there is no sequence in execution. How can I control the sequence of execution of my processes?
The wait for finish method will block the code, is there an alternative ?