当前位置: 首页>>代码示例>>Python>>正文


Python tty.TIOCSWINSZ属性代码示例

本文整理汇总了Python中tty.TIOCSWINSZ属性的典型用法代码示例。如果您正苦于以下问题:Python tty.TIOCSWINSZ属性的具体用法?Python tty.TIOCSWINSZ怎么用?Python tty.TIOCSWINSZ使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在tty的用法示例。


在下文中一共展示了tty.TIOCSWINSZ属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: openShell

# 需要导入模块: import tty [as 别名]
# 或者: from tty import TIOCSWINSZ [as 别名]
def openShell(self, proto):
        if not self.ptyTuple:  # We didn't get a pty-req.
            log.msg('tried to get shell without pty, failing')
            raise ConchError("no pty")
        uid, gid = self.avatar.getUserGroupId()
        homeDir = self.avatar.getHomeDir()
        shell = self.avatar.getShell()
        self.environ['USER'] = self.avatar.username
        self.environ['HOME'] = homeDir
        self.environ['SHELL'] = shell
        shellExec = os.path.basename(shell)
        peer = self.avatar.conn.transport.transport.getPeer()
        host = self.avatar.conn.transport.transport.getHost()
        self.environ['SSH_CLIENT'] = '%s %s %s' % (
            peer.host, peer.port, host.port)
        self.getPtyOwnership()
        self.pty = self._reactor.spawnProcess(
            proto, shell, ['-%s' % (shellExec,)], self.environ, homeDir, uid,
            gid, usePTY=self.ptyTuple)
        self.addUTMPEntry()
        fcntl.ioctl(self.pty.fileno(), tty.TIOCSWINSZ,
                    struct.pack('4H', *self.winSize))
        if self.modes:
            self.setModes()
        self.oldWrite = proto.transport.write
        proto.transport.write = self._writeHack
        self.avatar.conn.transport.transport.setTcpNoDelay(1) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:29,代码来源:unix.py

示例2: windowChanged

# 需要导入模块: import tty [as 别名]
# 或者: from tty import TIOCSWINSZ [as 别名]
def windowChanged(self, winSize):
        self.winSize = winSize
        fcntl.ioctl(
            self.pty.fileno(), tty.TIOCSWINSZ,
            struct.pack('4H', *self.winSize)) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:7,代码来源:unix.py

示例3: openShell

# 需要导入模块: import tty [as 别名]
# 或者: from tty import TIOCSWINSZ [as 别名]
def openShell(self, proto):
        from twisted.internet import reactor
        if not self.ptyTuple: # we didn't get a pty-req
            log.msg('tried to get shell without pty, failing')
            raise ConchError("no pty")
        uid, gid = self.avatar.getUserGroupId()
        homeDir = self.avatar.getHomeDir()
        shell = self.avatar.getShell()
        self.environ['USER'] = self.avatar.username
        self.environ['HOME'] = homeDir
        self.environ['SHELL'] = shell
        shellExec = os.path.basename(shell)
        peer = self.avatar.conn.transport.transport.getPeer()
        host = self.avatar.conn.transport.transport.getHost()
        self.environ['SSH_CLIENT'] = '%s %s %s' % (peer.host, peer.port, host.port)
        self.getPtyOwnership()
        self.pty = reactor.spawnProcess(proto, \
                  shell, ['-%s' % shellExec], self.environ, homeDir, uid, gid,
                   usePTY = self.ptyTuple)
        self.addUTMPEntry()
        fcntl.ioctl(self.pty.fileno(), tty.TIOCSWINSZ, 
                    struct.pack('4H', *self.winSize))
        if self.modes:
            self.setModes()
        self.oldWrite = proto.transport.write
        proto.transport.write = self._writeHack
        self.avatar.conn.transport.transport.setTcpNoDelay(1) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:29,代码来源:unix.py

示例4: windowChanged

# 需要导入模块: import tty [as 别名]
# 或者: from tty import TIOCSWINSZ [as 别名]
def windowChanged(self, winSize):
        self.winSize = winSize
        fcntl.ioctl(self.pty.fileno(), tty.TIOCSWINSZ, 
                        struct.pack('4H', *self.winSize)) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:6,代码来源:unix.py

示例5: setTerminalSize

# 需要导入模块: import tty [as 别名]
# 或者: from tty import TIOCSWINSZ [as 别名]
def setTerminalSize(terminalFD, ws_row=25, ws_col=80,
                    ws_xpixel=0, ws_ypixel=0):
    """
    Set the size of the given PTY leader file descriptor.
    """
    structformat = '4H'
    data = struct.pack(structformat, ws_row, ws_col, ws_xpixel, ws_ypixel)
    fcntl.ioctl(terminalFD, tty.TIOCSWINSZ, data) 
开发者ID:twisted,项目名称:imaginary,代码行数:10,代码来源:test_runner.py


注:本文中的tty.TIOCSWINSZ属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。