diff options
author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2003-03-12 09:43:49 +0000 |
---|---|---|
committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2003-03-12 09:43:49 +0000 |
commit | 3dc2b48c2c42c170f881b66ba63b352a15c751f3 (patch) | |
tree | 3d26c9cb3b7df69c15f8751b9162e44b105bf13f | |
parent | e0d90d9442074418f3766d89885f56afe4d903ce (diff) | |
download | pexpect-3dc2b48c2c42c170f881b66ba63b352a15c751f3.tar.gz |
Added run() function to Pexpect library.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@160 656d521f-e311-0410-88e0-e7920216d269
-rw-r--r-- | pexpect/README.txt | 3 | ||||
-rw-r--r-- | pexpect/pexpect.py | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/pexpect/README.txt b/pexpect/README.txt index a5870e9..e6dac00 100644 --- a/pexpect/README.txt +++ b/pexpect/README.txt @@ -1,6 +1,9 @@ Pexpect a Pure Python "Expect like" module +To work with this CVS repository you should source the cvs.conf file. + . ./cvs.conf + The purpose of the Pexpect module is to make Python be a better glue. Pexpect works like Don Libes' Expect. Use Pexpect when you want to diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py index 1f3cd99..bb14102 100644 --- a/pexpect/pexpect.py +++ b/pexpect/pexpect.py @@ -38,13 +38,13 @@ try: except ImportError, e: raise ImportError, str(e) + """ A critical module was not found. Probably this OS does not support it. -Currently pexpect is intended for UNIX operating systems (including OS-X).""" +Currently pexpect is intended for UNIX operating systems (including OS X).""" __version__ = '0.97' __revision__ = '$Revision$' -__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', +__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', '__version__', '__revision__'] @@ -65,6 +65,12 @@ class TIMEOUT(ExceptionPexpect): +def run (command, args=[], timeout=30): + """This runs a command; waits for it to finish; then returns all output as a string. This is a utility interface around the spawn class.""" + child = spawn(command, args, timeout) + child.expect (EOF) + return child.before + class spawn: """This is the main class interface for Pexpect. Use this class to start and control child applications. |