import sys
import notifier
import subprocess
notifier.init()

fd = None
def on_read(sock):
	print 'on_read'
	return True
def on_timer():
	print 'on_timer'
	notifier.socket_remove(fd)
	return True
p = subprocess.Popen('python -c "import sys; sys.stdin.read()"', shell=True, stdin=subprocess.PIPE)
fd = p.stdin.fileno()
notifier.socket_add(fd, on_read)
notifier.timer_add(0, on_timer)
p.communicate('A')
notifier.step()
