--pipe seems to work now, thanks to /dev/tty

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-06-09 01:50:43 -04:00
parent caca90bb35
commit 1120424255
1 changed files with 6 additions and 1 deletions

View File

@ -1112,8 +1112,13 @@ if __name__ == "__main__":
# if we used a pipe to read some data, that will be our first buffer
if opts.pipe:
raise Exception("--pipe doesn't work yet")
data = sys.stdin.read()
# since we just read until EOF from stdin, we need to reset STDIN using
# the TTY.
tty = open('/dev/tty', 'r')
os.dup2(tty.fileno(), sys.stdin.fileno())
# ok, so now create the actual buffer
b = buffer.data.DataBuffer('*Pipe*', data)
b.open()
buffers.append(b)