ptyhooks.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:PTYHooks 作者: linkedin 项目源码 文件源码
def copy_winsize(target_fd, source_fd=STDIN_FILENO):
    """
    Propagate terminal size from `source_fd` to `target_fd`.
    """
    # Create a buffer to store terminal size attributes. Refer to tty_ioctl(4)
    # for more information.
    winsize = array.array("h", [
        0,  # unsigned short ws_row
        0,  # unsigned short ws_col
        0,  # unsigned short ws_xpixel (unused)
        0,  # unsigned short ws_ypixel (unused)
    ])

    # Write window size into winsize variable.
    fcntl.ioctl(source_fd, termios.TIOCGWINSZ, winsize, True)
    # Send winsize to target terminal.
    fcntl.ioctl(target_fd, termios.TIOCSWINSZ, winsize)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号