Files in directory jni/pty_tcl in any check-in
A Tcl package to handle pseudo TTYs.
To open a pseudo TTY use the
pty::open command which will return the master channel and the name of the slave device file such as
package require pty lassign [pty::open] masterChan slaveName puts "Slave device file name: $slaveName" set slaveChan [open $slaveName r+] puts $masterChan "message from master" flush $masterChan puts "Received at slave: \"[gets $slaveChan]\"" puts $slaveChan "message from slave" flush $slaveChan puts "Received at master: \"[gets $masterChan]\"" close $slaveChan close $masterChan
Opens a pseudo TTY master slave pair and returns the pair as a list with the first element being the master channel and the second being the name of the slave device file. There is a single option:
- Prevents grantpt() from being run to change the mode and ownership of the slave pseudo-terminal device.
- A C/C++ compiler (Currently tested with gcc and g++)
- Tcl 8.5+ and development files
Compiling and Installing
pty is designed to be run under Unix and has been most thoroughly tested on Linux.
From the root directory of the repository, the directory this file is in, create the Makefiles:
$ configure ...
Then compile the project:
To install the package to a sensible location run the following as root. Make a note of the directories installed to in case of problems; these locations locations are also recorded in
$ make install
There is a test suite in
tests/. To run it:
$ tclsh tests/pty.test.tcl
If you find after installing that the package can't be found when
package require is called, then add part of the installation path to the environmental variable
TCLLIBPATH. For bash you could put the following in your
export TCLLIBPATH="$TCLLIBPATH /usr/local/lib"
Alternatively you could copy the files for the package (
libpty-tcl.so) to a directory such as
pty-tcl0.1/ off of one of the directories in Tcl's
auto_path variable. To find the directories in the
auto_path from the command line:
$ echo "puts \$auto_path" | tclsh
If you want to improve this package make a pull request to the repo on github. Please put any pull requests in a separate branch to ease integration and add a test to prove that it works.
Copyright (C) 2015, Lawrence Woodman email@example.com
This software is licensed under an MIT Licence. Please see the file, LICENCE.md, for details.