test_redisrwlock_connection.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:redisrwlock 作者: veshboo 项目源码 文件源码
def runRedisServer(port=6379):
    """runs redis-server"""
    # waits until it can accept client connection by reading its all
    # startup messages until it says 'ready to accept ...', then
    # redirect any following output to DEVNULL.
    port = str(port)
    server = subprocess.Popen(['redis-server', '--port', port],
                              stdout=subprocess.PIPE,
                              universal_newlines=True)
    message = _REDIS_READY_MESSAGE + port
    while message not in server.stdout.readline():
        pass
    dumper = subprocess.Popen(['cat'],
                              stdin=server.stdout,
                              stdout=subprocess.DEVNULL)
    return server, dumper
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号