January 2018
Intermediate to advanced
340 pages
8h 6m
English
In the previous example, we demonstrated how to run command strings. There is also an option to open a shell. By calling session.Shell(), an interactive login shell is executed, loading whatever default shell the user has and loading the default profile (for example, .profile). The call to session.RequestPty() is optional, but the shell works much better when requesting a psuedoterminal. You can set the terminal name to xterm, vt100, linux, or something custom. If you have issues with jumbled output due to color values being output, try vt100, and if that still does not work, use a nonstandard terminal name or a terminal name you know does not support colors. Many programs will disable color output if they do ...
Read now
Unlock full access