コード例 #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
ファイル: test_tty.py プロジェクト: dnephin/dockerpty
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
ファイル: test_tty.py プロジェクト: dnephin/dockerpty
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)