summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoah <noah@656d521f-e311-0410-88e0-e7920216d269>2002-09-20 05:46:11 +0000
committernoah <noah@656d521f-e311-0410-88e0-e7920216d269>2002-09-20 05:46:11 +0000
commitb7a6d40c6c6cc5ae6a66fffc9660445e807928bf (patch)
treef24560c4b53b2039276ca76adc6b74f66346f864
parent7c2e974d16dc274b6814f07dce42bd30491d4238 (diff)
downloadpexpect-b7a6d40c6c6cc5ae6a66fffc9660445e807928bf.tar.gz
log_open() was totally broken.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@68 656d521f-e311-0410-88e0-e7920216d269
-rwxr-xr-xpexpect/examples/passmass.py1
-rw-r--r--pexpect/pexpect.py5
2 files changed, 3 insertions, 3 deletions
diff --git a/pexpect/examples/passmass.py b/pexpect/examples/passmass.py
index 34681b7..bb5fb51 100755
--- a/pexpect/examples/passmass.py
+++ b/pexpect/examples/passmass.py
@@ -12,6 +12,7 @@ SHELL_PROMPT = '[#\$] '
def login(host, user, password):
child = pexpect.spawn('ssh %s@%s'%(user, host))
+ child.log_open('LOG')
child.expect('password:')
child.sendline(password)
i = child.expect(['Permission denied', SHELL_PROMPT, 'Terminal type'])
diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py
index c7b5a1d..2e7659b 100644
--- a/pexpect/pexpect.py
+++ b/pexpect/pexpect.py
@@ -173,10 +173,9 @@ class spawn:
"""This opens a log file. All data read from the child
application will be written to the log file.
This is very useful to use while creating scripts.
- You can use this to figure out exactly what the child
- is sending.
+ You can use this to figure out exactly what the child is sending.
"""
- self.log_fd = os.open (filename, O_APPEND | O_CREAT)
+ self.log_fd = os.open (filename, os.O_WRONLY | os.O_CREAT | os.O_APPEND)
def log_close (self):
"""This closes the log file opened by log().