diff options
Diffstat (limited to 'pexpect/pexpect.py')
-rw-r--r-- | pexpect/pexpect.py | 16 |
1 files changed, 8 insertions, 8 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. |