Package pymeterlib :: Module pyssh_ptyext
[show private | hide private]
[frames | no frames]

Module pymeterlib.pyssh_ptyext

Pseudo terminal utilities.
Function Summary
  _copy(master_fd, master_read, stdin_read, stdin_fd, stdout_fd)
Parent copy loop.
  _open_terminal()
Open pty master and return (master_fd, tty_name).
  _read(fd)
Default read function.
  _writen(fd, data)
Write all the data to a descriptor.
  fork()
fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.
  master_open()
master_open() -> (master_fd, slave_name) Open a pty master and return the fd, and the filename of the slave end.
  openpty()
openpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.
  popen2(cmd, bufsize, master_read, stdin_read)
Execute the shell command 'cmd' in a sub-process.
  slave_open(tty_name)
slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor.
  spawn(argv, master_read, stdin_read, stdin_fd, stdout_fd)
Create a spawned process.
  th_spawn(argv, master_read, stdin_read, stdin_fd, stdout_fd)
Create a spawned process.

Variable Summary
int CHILD = 0                                                                     
int STDERR_FILENO = 2                                                                     
int STDIN_FILENO = 0                                                                     
int STDOUT_FILENO = 1                                                                     

Function Details

_copy(master_fd, master_read=<function _read at 0xb7e24534>, stdin_read=<function _read at 0xb7e24534>, stdin_fd=0, stdout_fd=1)

Parent copy loop. Copies pty master -> stdout_fd (master_read) stdin_fd -> pty master (stdin_read)

_open_terminal()

Open pty master and return (master_fd, tty_name). SGI and generic BSD version, for when openpty() fails.

_read(fd)

Default read function.

_writen(fd, data)

Write all the data to a descriptor.

fork()

fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.

master_open()

master_open() -> (master_fd, slave_name) Open a pty master and return the fd, and the filename of the slave end. Deprecated, use openpty() instead.

openpty()

openpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.

popen2(cmd, bufsize=1024, master_read=<function _read at 0xb7e24534>, stdin_read=<function _read at 0xb7e24534>)

Execute the shell command 'cmd' in a sub-process.

If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The function returns (child_stdin, child_stdout, child_pid), where the file objects are pipes connected to the spawned process's controling terminal, and the child_pid is the pid of the child process.

slave_open(tty_name)

slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.

spawn(argv, master_read=<function _read at 0xb7e24534>, stdin_read=<function _read at 0xb7e24534>, stdin_fd=0, stdout_fd=1)

Create a spawned process. The controlling terminal reads and writes its data to stdin_fd and stdout_fd respectively.

NOTE: This function does not return until one of the input or output file descriptors are closed, or the child process exits.

th_spawn(argv, master_read=<function _read at 0xb7e24534>, stdin_read=<function _read at 0xb7e24534>, stdin_fd=0, stdout_fd=1)

Create a spawned process. The controlling terminal reads and writes its data to stdin_fd and stdout_fd respectively. The function returns the pid of the spawned process. (It returns immediately.)

Variable Details

CHILD

Type:
int
Value:
0                                                                     

STDERR_FILENO

Type:
int
Value:
2                                                                     

STDIN_FILENO

Type:
int
Value:
0                                                                     

STDOUT_FILENO

Type:
int
Value:
1                                                                     

Generated by Epydoc 2.1 on Fri Mar 17 09:16:20 2006 http://epydoc.sf.net