Added system.wait for promise-based timeouts.