def check_mongo_server_output(binary, argument):
    """Call mongo[d|s] with arguments such as --help or --version.

    This is used only to check the server's output. We expect the server to
    exit immediately.
    """
    try:
        proc = subprocess.Popen(['%s' % binary, argument],
                                stderr=subprocess.STDOUT,
                                stdout=subprocess.PIPE, shell=False)
    except OSError as exc:
        print('Failed to launch %s' % binary)
        raise exc

    out, err = proc.communicate()
    if proc.returncode:
        raise OSError(out or err)

    return out