예제 #1
0
파일: pty.py 프로젝트: aanand/dockerpty
    def resize(self, size=None):
        """
        Resize the container's PTY.

        If `size` is not None, it must be a tuple of (height,width), otherwise
        it will be determined by the size of the current TTY.
        """

        if not self.israw():
            return

        size = size or tty.size(sys.stdout)

        if size is not None:
            rows, cols = size
            try:
                self.client.resize(self.container, height=rows, width=cols)
            except IOError: # Container already exited
                pass
예제 #2
0
파일: pty.py 프로젝트: rafalozan0/sama
    def resize(self, size=None):
        """
        Resize the container's PTY.

        If `size` is not None, it must be a tuple of (height,width), otherwise
        it will be determined by the size of the current TTY.
        """

        if not self.israw():
            return

        size = size or tty.size(self.stdout)

        if size is not None:
            rows, cols = size
            try:
                self.client.resize(self.container, height=rows, width=cols)
            except IOError:  # Container already exited
                pass
예제 #3
0
def test_size_returns_a_tuple_for_a_tty():
    fd, __ = pty.openpty()
    fd = os.fdopen(fd)
    util.set_pty_size(fd, (43, 120))
    expect(tty.size(fd)).to.equal((43, 120))
예제 #4
0
def test_size_returns_none_for_non_tty():
    with tempfile.TemporaryFile() as t:
        expect(tty.size(t)).to.be.none
예제 #5
0
def test_size_returns_a_tuple_for_a_tty():
    fd, __ = pty.openpty()
    fd = os.fdopen(fd)
    util.set_pty_size(fd, (43, 120))
    expect(tty.size(fd)).to(equal((43, 120)))
예제 #6
0
def test_size_returns_none_for_non_tty():
    with tempfile.TemporaryFile() as t:
        expect(tty.size(t)).to(be_none)