Helmut Eller heller@common-lisp.net writes:
1 Start slime with one of the two lisp implementaitons mentioned above 2 Open "/dev/tty.NXT-DevB-1", which is a serial blue tooth connection to a Lego NXT brick. 3 Turn of the Lego NXT brick (the other side of the serial connection)
Fancy toys.
Yes, a great present from my girlfriend.
In contrast, if I do not run this through slime, but just run it from a terminal the lisp implementaiton is not killed.
To me it looks like the subprocess receives a SIGHUP when the serial connection goes down. At least http://en.wikipedia.org/wiki/SIGHUP mentions that as the historical usage of SIGHUP.
This is indeed the problem, see below for what happens.
Perhaps it helps if you install a signal handler for SIGHUP to ignore it.
This works.
It might also help to bind process-connection-type in slime-start-lisp to 'pty instead of nil.
This does not work.
After some playing around, I have some better idea of what happens.
* SIGHUP is send if darwin detects that the controlling terminal of a process is disconnected. * SIGHUP kills the lisp process * If lisp is started from the command line, the lisp process has a controlling terminal, presumably setup by the shell. * If lisp is started by slime, the lisp process does not have a controlling terminal. * If the lisp image opens the /dev/tty.NXT-DevB-1 device and the lisp process does not have a controlling terminal, the /dev/tty.NXT-DevB-1 becomes a controlling terminal.
The upshot is, that:
1 - If lisp is started through slime, the NXT device will become a controlling terminal and therefore, breaking the connection will send a SIGHUP to the lisp process. Duefully killing the lisp process.
2- If lisp is started from the command line, the NXT device does NOT become a controlling terminal and therefore lisp is not killed by breaking the bluetooth connection.
So it seems that everything works as it should. Although, I rather not spend my time debugging these kind of issues :-(.
I assume now that I have to use implementation dependend hacks to configure the /dev/tty.NXT-DevB-1 device to configure the terminal NOT to send SIGHUP when connection goes away, or make sure the terminal will not be a controlling terminal. Bleh.
Anyway, thanks for the help, it has been educational.
Wim Oudshoorn.