This is a copy-paste from wd_server, maybe extract it into process_utils as a helper function taking (app, flags) and returning the browser object?