If you've used screen, it's a similar concept, but more suited to traditional scrolling interfaces whereas screen is better for full-screen (e.g. curses-based) apps. Compared to screen, detachtty
- has no capability to swap between different screens (doesn't eat C-a)
- runs in line-at-a-time mode with no tty emulation (you can sanely use it in emacs comint modes or from inside a script(1) session)
- has no features (less to go wrong)
- and thus doesn't need a configuration file either
Example usage
server$ detachtty --dribble-file /var/log/cliki-dribble --log-file \ /var/log/detachtty.log --pid-file /var/run/cliki.pid \ /var/run/cliki-socket /usr/bin/lisp -eval '(load-system :telentweb)' \ -eval '(progn (telentweb::init) (telentweb::start))' \ client$ attachtty dan@server:/var/run/cliki-socket
to quit attachtty press ^\
Running via detachtty at startup
Start a script late .. i.e. S9xlispapp in rc[2|3].d/
start S9xlispapp
#!/bin/sh su - user -c /path/to/lisp-app-scriptend S9xlispapp
start lisp-app-script
#!/bin/sh detachtty --dribble-file /var/log/lisp-app-dribble --log-file \ /var/log/detachtty.log --pid-file /var/run/lisp-app.pid \ /var/run/lisp-app-socket /usr/bin/lisp -eval '(start-lisp-app)'end lisp-app-script
-quasi (credit to Eduardo Muñoz for this information)
A more featureful init.d startup script for debian and compatible linuxes is introduced in https://boinkor.net/2006/02/starting-daemonized-lisp-images-in-debian/
Actual usage
detachtty is running the SBCL instance that CLiki runs on
Compatibility
detachtty is mostly tested on Debian GNU/Linux, but contributed patches for FreeBSD and Solaris have been merged into it, so it's probably not too hard to get running on many Unices
apparently, it worked on macos at one time, but that is no longer true under macos 10.4 (tiger). It seems that tiger's poll does not work as advertised. it works on Tiger using poll-emulator from MacPorts ("OS_LOADLIBES=-lpoll -L/opt/local/lib" is the only change required to make it work on Intel, but I'm having some issues on PPC)
Download
i386 Debian and source packages (currently at version 9) are at ftp://ftp.linux.org.uk/pub/lisp/detachtty/. This package is also
available in the main Debian repository. There's also a FreeBSD port, misc/detachtty, which you can get from the ports tree.
A new version, which includes the ability to set timeouts and pass code to the detach'd lisp (for better scriptablity) is available in the darcs repo at:
http://common-lisp.net/project/bese/repos/detachtty
Patches against that code would are more than welcome.
Remark:
When I started my Lisp image at Systemstart I got always errors like:
c-string encoding error (:external-format :ASCII): the character with code 195 cannot be encoded. [Condition of type SB-INT:C-STRING-ENCODING-ERROR]
But it worked when I tried to start my Lisp image via the init.d script in the comandline.
The problem was solved when I added the following declarations to my init.d script:
LC_CTYPE=en_US.UTF-8 export LC_CTYPE
See also: comp.lang.lisp thread