diff options
author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2003-05-05 01:34:26 +0000 |
---|---|---|
committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2003-05-05 01:34:26 +0000 |
commit | d227ad52f2516463d9a5c5680459052dbb50cbe7 (patch) | |
tree | e0c6f1cdea43a9438f95f2da56aabf7c25876427 | |
parent | 86b2a98c4dc9f477bf4f8caa1794d31f55a3c57e (diff) | |
download | pexpect-d227ad52f2516463d9a5c5680459052dbb50cbe7.tar.gz |
Fixed bugs introduced by renaming some of the global functions.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@187 656d521f-e311-0410-88e0-e7920216d269
-rw-r--r-- | pexpect/pexpect.py | 16 | ||||
-rwxr-xr-x | pexpect/tests/test_command_list_split.py | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py index 3e49eeb..5c87606 100644 --- a/pexpect/pexpect.py +++ b/pexpect/pexpect.py @@ -143,7 +143,7 @@ class spawn: raise TypeError, 'The second argument, args, must be a list.' if args == []: - self.args = __split_command_line(command) + self.args = _split_command_line(command) self.command = self.args[0] else: args.insert (0, command) @@ -184,7 +184,7 @@ class spawn: assert self.pid == None, 'The pid member is not None.' assert self.command != None, 'The command member is None.' - if __which(self.command) == None: + if _which(self.command) == None: raise ExceptionPexpect ('The command was not found or was not executable: %s.' % self.command) try: @@ -193,8 +193,8 @@ class spawn: raise ExceptionPexpect('Pexpect: pty.fork() failed: ' + str(e)) if self.pid == 0: # Child - try: # Some platforms do not like __setwinsize (for example, Cygwin). - __setwinsize(24, 80) + try: # Some platforms do not like _setwinsize (for example, Cygwin). + _setwinsize(24, 80) except: pass # Do not allow child to inherit open file descriptors from parent. @@ -739,7 +739,7 @@ class spawn: # End of Spawn ############################################################################## -def __which (filename): +def _which (filename): """This takes a given filename; tries to find it in the environment path; then checks if it is executable. """ @@ -765,7 +765,7 @@ def __which (filename): return f return None -def __setwinsize(r, c): +def _setwinsize(r, c): """This sets the windowsize of the tty for stdout. This does not change the physical window size. It changes the size reported to TTY-aware applications like @@ -789,12 +789,12 @@ def __setwinsize(r, c): s = struct.pack("HHHH", r, c, 0, 0) x = fcntl.ioctl(sys.stdout.fileno(), TIOCSWINSZ, s) -def __getwinsize(): +def _getwinsize(): s = struct.pack("HHHH", 0, 0, 0, 0) x = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, s) return struct.unpack("HHHH", x) -def __split_command_line(command_line): +def _split_command_line(command_line): """This splits a command line into a list of arguments. It splits arguments on spaces, but handles embedded quotes, doublequotes, and escaped characters. diff --git a/pexpect/tests/test_command_list_split.py b/pexpect/tests/test_command_list_split.py index 135c5d6..c579cd3 100755 --- a/pexpect/tests/test_command_list_split.py +++ b/pexpect/tests/test_command_list_split.py @@ -5,13 +5,13 @@ import unittest class SplitCommandLineTestCase(unittest.TestCase): #def runTest (self): def testSplitSizes(self): - assert len(pexpect.split_command_line(r'')) == 0 - assert len(pexpect.split_command_line(r'one')) == 1 - assert len(pexpect.split_command_line(r'one two')) == 2 - assert len(pexpect.split_command_line(r'one\ one')) == 1 - assert len(pexpect.split_command_line('\'one one\'')) == 1 - assert len(pexpect.split_command_line(r'one\"one')) == 1 - assert len(pexpect.split_command_line(r'This\' is a\'\ test')) == 3 + assert len(pexpect._split_command_line(r'')) == 0 + assert len(pexpect._split_command_line(r'one')) == 1 + assert len(pexpect._split_command_line(r'one two')) == 2 + assert len(pexpect._split_command_line(r'one\ one')) == 1 + assert len(pexpect._split_command_line('\'one one\'')) == 1 + assert len(pexpect._split_command_line(r'one\"one')) == 1 + assert len(pexpect._split_command_line(r'This\' is a\'\ test')) == 3 if __name__ == '__main__': unittest.main() |