#!/usr/bin/env python2.2

"""

A little pipe test

This is the master program

"""

import os, tempfile

# make a FIFO

tempfile = tempfile.mktemp()

print "creating temfilename:", tempfile
fifo = os.mkfifo(tempfile)

# start up slave process:
print "about to start the slave"
os.system( "./slave.py %s &"%tempfile )


print "about to open the fifo"
infile = open(tempfile,'r')


while 1:
     line = infile.readline()
     if not line:
          break
     print line
     t = raw_input("press a key to continue, or 'x' to stop >>")
     if t.strip() == "x":
          print "breaking"
          break

#os.unlink(tempfile)




