The solution for this category of problems is to implement a loop and to terminate the setup.exe when it has written a success message to the installation log. In the case below it is Installation process succeeded. Btw, thanks to Janik Vonrotz who provided the logging function.
c01484d022