Unspawned objects

There are often times where expect-send is needed on normal files, instead of a process.

The file object passed to an unspawned objects are assumed to be owned by another part of the process. This means that closing these objects does not close the file.

Members and methods

Except for those listed below, all other members and methods are the same as for spawned objects.
pid
Will always be zero since it is not associated with a process
pty
The name of the open file object
command
Always an empty string

Predefined unspawned objects

Examples

Open a socket to the local machine's mailer program.
import select, socket
remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
remote.connect('localhost', 'smtp')
spawn_id = ExpectPy.spawnfile(remote)
select.select([spawn_id], [], [])
spawn_id.expect((ExpectPy.GLOB, "200 *\r\n", 1))
spawn_id.send("HELO localhost\r")
...
spawn_id.send("QUIT\r")
spawn_id.close()
remote.close()