Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 442 Bytes

README.md

File metadata and controls

21 lines (16 loc) · 442 Bytes

nbsubprocess

a non-blocking subprocess lib for tornado

Usage

from nbsubprocess import NonBlockingSubprocess
from tornado.gen import Task, coroutine

class MyHandler(RequestHandler):
    @corotine
    def get(self):
        cmd = "echo hello && sleep 1 && echo goodbye"
        res = yield Task(NonBlockingSubprocess(cmd).loop)
        return_code = res.pipe.return_code
        output = res.output

Test

nose test.py