rif writes: > > I've been using CMUCL's run-process extension to communicate with R > via a pty to make graphics. For reasons I've not yet determined, > every so often the process chokes, and my recourse is to kill the > process and start a new one. > > Fine so far, but now I can't start a new one, because I'm out of pty's: > > * (start-r) > > > Error in function EXTENSIONS::FIND-A-PTY: Could not find a pty. > [Condition of type SIMPLE-ERROR] [ remainder snipped ]
It looks like find-a-pty iterates over the ptys in /dev, trying to open each one in turn until one succeeds, or all attempts fail. You didn't say what OS you were using, but if it has a /proc filesystem, why not use it to find which unused pty's are still open and call unix:unix-close on the file descriptors. On my system (Linux), you can do this: $ cd /proc/$$/fd && ls -l total 0 lrwx------ 1 craigl craigl 64 Nov 6 21:30 0 -> /dev/pts/0 lrwx------ 1 craigl craigl 64 Nov 6 21:30 1 -> /dev/pts/0 lrwx------ 1 craigl craigl 64 Nov 6 21:30 2 -> /dev/pts/0 lrwx------ 1 craigl craigl 64 Nov 6 21:30 255 -> /dev/pts/0 Alternatives might include the lsof or fuser programs. Regards, Craig Ludington -- Craig Ludington __o 2446 N. Albany Avenue ---_ \<,_ Chicago, IL 60647-2602 ---- (_)/ (_) <[EMAIL PROTECTED]> (773) 252-6911 GPG public key: http://gnunotunix.org/public-key.txt
