recording terminal (bash) session w/ script locks in stty/tput lines/cols. reddit / BSD ---------------------------------------------------------------------- kggdgqdas · 2018-10-31 13:01 Hello.. I posted this a few days ago in /r/macos, but have had zero responses. I hope that perhaps /r/BSD might have some insight. I'm trying to use /usr/bin/script to record a terminal session. Whenever I start the /usr/bin/script program, what ever the current size of my window (lines/columns) is locked. I can resize the terminal window all I want, and the window title changes to reflect the new dimensions; but the actual useable rows/columns that I can utilize in the terminal session remain locked at whatever I had when I initially started the /usr/bin/script session. I don't have this problem when using script on a Debian box under gnome. Is there a way to have windows changes to the terminal app reflect the actual # of usable lines/columns used during the /usr/bin/script session? Thanks. ---------------------------------------------------------------------- jaypatelani · 2018-10-31 13:09 Something like this? https://asciinema.org/a/4mp06buzc9wetwv5qwn7tt59w ---------------------------------------------------------------------- kggdgqdas · 2018-10-31 13:28 I think your reply was to point out the asciinema tool, as a way to record a terminal session. If so, thank you for that. But my question was more about why the stty and tput programs don't reset my terminal width and height correctly once I start recording my terminal session with the more traditional 'script' binary program. Whenever I use '/usr/bin/script' - If I resize my terminal, from say 80x20 to 125x65, the actual session doesn't realize that. So if I were to open a file with vim, I only have 80x20 useable columns and rows to work with, even though my terminal window should allow 125x65. If I do the same thing w/o running /usr/bin/script, I don't have this problem. Hopefully that makes my question/concern a little more clear. Thanks. ---------------------------------------------------------------------- phobug · 2018-10-31 13:35 can we see the script in question or at least give us a breakdown of the commands and shell functions? ---------------------------------------------------------------------- phobug · 2018-10-31 13:41 ok, found out about it... The script command appeared in 3.0BSD. source: http://man7.org/linux/man-pages/man1/script.1.html ---------------------------------------------------------------------- kggdgqdas · 2018-10-31 13:49 I haven't yet read your second reply yet, but I have posted some screenshots of this phenomenon using just the cli command '/usr/bin/screen'. [before and just after /usr/bin/script started](https://imgur.com/4GmXWHp) [during script, after resizing](https://imgur.com/WQPxlMd) ---------------------------------------------------------------------- phobug · 2018-10-31 13:51 now what you can do is go down the rabbit hole of FOSS. From the above man page I found the following git page https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/about/ there you can see the mailing list: MAILING LIST: E-MAIL: util-linux@vger.kernel.org URL: http://vger.kernel.org/vger-lists.html#util-linux I would advice searching there. If you decide to write them you can, but be mindful of the rules: The mailing list will reject email messages that contain: - more than 100K characters - html - spam phrases/keywords See: http://vger.kernel.org/majordomo-info.html#taboo ---------------------------------------------------------------------- Kernigh · 2018-10-31 23:48 You're looking at the Linux version of script(1), but we are using [the BSD version of script(1)](https://opensource.apple.com/source/she ll_cmds/shell_cmds-203/script/). ---------------------------------------------------------------------- Kernigh · 2018-11-01 01:32 I found [the source code of Apple's script(1)](https://opensource.appl e.com/source/shell_cmds/shell_cmds-203/script/). There's no code to handle resizing the terminal. You would need to edit the code and run a C compiler. I'm on OpenBSD and don't have this problem because [OpenBSD's script.c](http://cvsweb.openbsd.org/cgi- bin/cvsweb/src/usr.bin/script/script.c) had [added the resize handler](http://cvsweb.openbsd.org/cgi- bin/cvsweb/src/usr.bin/script/script.c.diff?r1=1.11&r2=1.12) 18 years ago. script(1) makes its own terminal to capture the output, record it, and relay it to the outer terminal. When you resize the outer terminal, it sends SIGWINCH to script(1). The resize handler should respond to SIGWINCH by getting the new size from the outer terminal (TIOCGWINSZ), setting the size of its own terminal (TIOCSWINSZ), and sending SIGWINCH to the process group of its own terminal. ---------------------------------------------------------------------- oh5nxo · 2018-11-09 09:00 Do you know (and have) the command "resize -s" ? Not a complete solution, but maybe enough. You'd need to execute it after each window size change.