Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ptyprocess/_fork_pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import errno

from pty import (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO, CHILD)
from .util import PtyProcessError

def fork_pty():
'''This implements a substitute for the forkpty system call. This
Expand Down Expand Up @@ -63,7 +64,7 @@ def pty_make_controlling_tty(tty_fd):
try:
fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY)
os.close(fd)
raise ExceptionPexpect("OSError of errno.ENXIO should be raised.")
raise PtyProcessError("OSError of errno.ENXIO should be raised.")
except OSError as err:
if err.errno != errno.ENXIO:
raise
Expand All @@ -74,4 +75,4 @@ def pty_make_controlling_tty(tty_fd):

# Verify we now have a controlling tty.
fd = os.open("/dev/tty", os.O_WRONLY)
os.close(fd)
os.close(fd)
5 changes: 1 addition & 4 deletions ptyprocess/ptyprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Constants
from pty import (STDIN_FILENO, CHILD)

from .util import which
from .util import which, PtyProcessError

_platform = sys.platform.lower()

Expand Down Expand Up @@ -81,9 +81,6 @@ def _make_eof_intr():
_INTR = _byte(intr)
_EOF = _byte(eof)

class PtyProcessError(Exception):
"""Generic error class for this package."""

# setecho and setwinsize are pulled out here because on some platforms, we need
# to do this from the child before we exec()

Expand Down
6 changes: 5 additions & 1 deletion ptyprocess/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ def _access_check(fn, mode):
name = os.path.join(dir, thefile)
if _access_check(name, mode):
return name
return None
return None


class PtyProcessError(Exception):
"""Generic error class for this package."""