summaryrefslogtreecommitdiff
path: root/pexpect/fdpexpect.py
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-09-20 18:21:42 -0700
committerThomas Kluyver <takowl@gmail.com>2013-09-20 18:21:42 -0700
commit81e7f9e3eca3966516af91e507ccc3ba5ad301a7 (patch)
tree01c6ab59adb4900d2f72e782b4adc3494efd53e2 /pexpect/fdpexpect.py
parent908a94b15db61ae42f7b9cc3406a9192b26c4ef9 (diff)
downloadpexpect-81e7f9e3eca3966516af91e507ccc3ba5ad301a7.tar.gz
Fix fdpexpect for Python 3
Diffstat (limited to 'pexpect/fdpexpect.py')
-rw-r--r--pexpect/fdpexpect.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/pexpect/fdpexpect.py b/pexpect/fdpexpect.py
index 38b09b6..ea5cbaa 100644
--- a/pexpect/fdpexpect.py
+++ b/pexpect/fdpexpect.py
@@ -21,7 +21,7 @@ PEXPECT LICENSE
'''
-from pexpect import *
+from pexpect import spawn, ExceptionPexpect
import os
__all__ = ['fdspawn']
@@ -45,12 +45,12 @@ class fdspawn (spawn):
fd = fd.fileno()
if type(fd) != type(0):
- raise ExceptionPexpect ('The fd argument is not an int. If this is a command string then maybe you want to use pexpect.spawn.')
+ raise ExceptionPexpect('The fd argument is not an int. If this is a command string then maybe you want to use pexpect.spawn.')
try: # make sure fd is a valid file descriptor
os.fstat(fd)
except OSError:
- raise ExceptionPexpect, 'The fd argument is not a valid file descriptor.'
+ raise ExceptionPexpect('The fd argument is not a valid file descriptor.')
self.args = None
self.command = None
@@ -61,23 +61,18 @@ class fdspawn (spawn):
self.name = '<file descriptor %d>' % fd
def __del__ (self):
-
return
def close (self):
-
if self.child_fd == -1:
return
- if self.own_fd:
- self.close (self)
- else:
- self.flush()
- os.close(self.child_fd)
- self.child_fd = -1
- self.closed = True
- def isalive (self):
+ self.flush()
+ os.close(self.child_fd)
+ self.child_fd = -1
+ self.closed = True
+ def isalive (self):
'''This checks if the file descriptor is still valid. If os.fstat()
does not raise an exception then we assume it is alive. '''
@@ -90,10 +85,8 @@ class fdspawn (spawn):
return False
def terminate (self, force=False):
-
- raise ExceptionPexpect ('This method is not valid for file descriptors.')
+ raise ExceptionPexpect('This method is not valid for file descriptors.')
def kill (self, sig):
-
+ """No-op - no process to kill."""
return
-