Skip to content

Instantly share code, notes, and snippets.

@proger
Created August 14, 2011 19:55
Show Gist options
  • Select an option

  • Save proger/1145237 to your computer and use it in GitHub Desktop.

Select an option

Save proger/1145237 to your computer and use it in GitHub Desktop.
wtf?
import os, sys, socket, time
socket.setdefaulttimeout(10)
r,w = socket.socketpair()
def child():
try:
print r.recv(10)
except socket.timeout:
print 'noread'
w.send('aa') # o_O
print r.recv(10)
sys.exit(0)
pid = os.fork()
if pid == 0:
child()
time.sleep(1)
w.close()
os.waitpid(pid, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment