diff options
author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2002-10-07 10:43:59 +0000 |
---|---|---|
committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2002-10-07 10:43:59 +0000 |
commit | f78334f1c0cb00e6371a3e7eab395f157e5afd1c (patch) | |
tree | aeae5384f77f78cd9d0522e20fa15581439abc1e | |
parent | bfe79aa8657fb93e3d9d2c686b9e5be6485e22f6 (diff) | |
download | pexpect-f78334f1c0cb00e6371a3e7eab395f157e5afd1c.tar.gz |
Trying to find a damn Solaris bug.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@100 656d521f-e311-0410-88e0-e7920216d269
-rw-r--r-- | pexpect/pexqa.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pexpect/pexqa.py b/pexpect/pexqa.py new file mode 100644 index 0000000..09dddc9 --- /dev/null +++ b/pexpect/pexqa.py @@ -0,0 +1,42 @@ +import os, sys +import select +import signal +import traceback +import time +import re +import struct +from types import * +import posix + +import pty +import tty +import termios +import fcntl +class s: + def __init__(self, command, args=None, timeout=30): + + self.pid = self.child_fd = None + try: + #self.pid, self.child_fd = posix.forkpty() + self.pid, self.child_fd = pty.fork() + except OSError, e: + raise Exception('posix.fork() failed: ' + str(e)) + + if self.pid == 0: # Child + os.execvp(command, args) + + # Parent + + def __del__(self): + if self.child_fd is not -1: + os.close (self.child_fd) + +print '1' +x = s('ls', ['ls']) +time.sleep(5) +print '2' +some = os.read (x.child_fd, 3225) +print '3' +print some +print '4' + |