Copied in exec_app.rb from OmfCommon as it is useful here as well