Skip to content

Instantly share code, notes, and snippets.

@cablehead
Created March 22, 2015 21:23
Show Gist options
  • Save cablehead/b0347c95dc2282c92735 to your computer and use it in GitHub Desktop.
Save cablehead/b0347c95dc2282c92735 to your computer and use it in GitHub Desktop.
import vanilla
h = vanilla.Hub()
b = h.bean(8080)
@b.websocket('/')
def _(ws):
child = h.process.execv(['/usr/bin/env', 'grep', '--line-buffered', 'foo'])
child.stdout.pipe(ws)
while True:
child.stdin.send(ws.recv()+'\n')
h.stop_on_term()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment