Home | History | Annotate | Download | only in examples

Lines Matching refs:child

12 child = pexpect.spawn('ftp ftp.openbsd.org')
13 child.expect('(?i)name .*: ')
14 child.sendline('anonymous')
15 child.expect('(?i)password')
16 child.sendline('pexpect@sourceforge.net')
17 child.expect('ftp> ')
18 child.sendline('cd /pub/OpenBSD/3.7/packages/i386')
19 child.expect('ftp> ')
20 child.sendline('bin')
21 child.expect('ftp> ')
22 child.sendline('prompt')
23 child.expect('ftp> ')
24 child.sendline('pwd')
25 child.expect('ftp> ')
27 sys.stdout.write (child.after)
29 child.interact() # Escape character defaults to ^]
31 # or until the child exits. The human user and the child should be talking
38 # This makes sure the child is dead; although it would be killed when Python exits.
39 if child.isalive():
40 child.sendline('bye') # Try to ask ftp child to exit.
41 child.close()
42 # Print the final state of the child. Normally isalive() should be FALSE.
43 if child.isalive():
44 print 'Child did not exit gracefully.'
46 print 'Child exited gracefully.'