check process until wait timeout *and* break if no more running
refactor logic in submodules