go - Setting the terminal size (ala `stty columns` ) of another process? -


i'm using github.com/kr/pty package create pseudo-tty external processes spawn off. terminal size them seems smaller terminal emulator window size (ie ncurses , other terminal uis draw in top left corner of xterm / konsole / whatever).

i have raised bug pty package idea way fix issue package itself, work around might handy if set dimensions of tty myself (in code).

how go doing this?

nb project written in go (golang) ideally i'd need advice in doing in c or go. project i'm working on has strong emphasis on cross platform compatibility handy know if syscalls required os specific.

i found solution. turns out creating new pseudo-tty wrong approach , can use standard go libraries achieve wanted:

cmd := exec.command(name, parameters...)  cmd.sysprocattr = &syscall.sysprocattr{     ctty: int(os.stdout.fd()) // set tty }  // these must respective std os.file using reader/writer  // wouldn't work if you're trying assign tty terminal // emulator. cmd.stdin = os.stdin cmd.stdout = os.stdout cmd.stderr = os.stderr 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -