rewrote waitForLaunch
Merge pull request #2182 from sebv/test-prelaunch

rewrote waitForLaunch