summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoah <noah@656d521f-e311-0410-88e0-e7920216d269>2003-02-26 06:34:12 +0000
committernoah <noah@656d521f-e311-0410-88e0-e7920216d269>2003-02-26 06:34:12 +0000
commit93f1d0712c109da95e1ceede1e6516fe875c2e9f (patch)
tree43695547b6ce872211cc974cb92d420218dbfe29
parent1243c6f957549bdb0a8edc4245db014ea7bb529e (diff)
downloadpexpect-93f1d0712c109da95e1ceede1e6516fe875c2e9f.tar.gz
For pexpect.py I did something wrong that I will have to fix in a minute...
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@157 656d521f-e311-0410-88e0-e7920216d269
-rw-r--r--pexpect/pexpect.py12
-rwxr-xr-xpexpect/tools/testsweep.py2
2 files changed, 8 insertions, 6 deletions
diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py
index ccae6c8..5859e76 100644
--- a/pexpect/pexpect.py
+++ b/pexpect/pexpect.py
@@ -193,11 +193,12 @@ class spawn:
return self.child_fd
def close (self): # File-like object.
- """This is experimental.
- This closes the file descriptor of the child application.
+ """ This closes the file descriptor of the child application.
It makes no attempt to actually kill the child or wait for its status.
+ If the child file descriptor was opened outside of this spawned class
+ (passed to the constructor) then this does not close the file descritor.
"""
- if self.child_fd != -1:
+ if self.child_fd != -1 and not self.nofork:
self.flush()
os.close (self.child_fd)
self.child_fd = -1
@@ -208,9 +209,10 @@ class spawn:
pass
def isatty (self): # File-like object.
- """This always returns 1.
+ """This returns 1 if the file descriptor is open and
+ connected to a tty(-like) device, else 0.
"""
- return 1
+ return os.isatty(child_fd)
def setecho (self, on):
"""This sets the terminal echo-mode on or off."""
diff --git a/pexpect/tools/testsweep.py b/pexpect/tools/testsweep.py
index ba15174..1e7bf6c 100755
--- a/pexpect/tools/testsweep.py
+++ b/pexpect/tools/testsweep.py
@@ -8,7 +8,7 @@ import getpass
def test_platform (platform_menu, platform_python_path):
try:
s = pexpect.spawn ('ssh noah@cf.sourceforge.net')
- s.setlog (sys.stdout)
+ #s.setlog (sys.stdout)
i = s.expect (['password:', 'yes/no'])
if i == 1:
s.sendline ('yes')