Re: run/collecting, not threads

Martin Gasbichler <[email protected]> Wed, 26 Apr 2006 11:46:45 +0200
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
Emilio Lopes <[email protected]> writes:
[snip]
> If you substitute `ls' by something appropriate, like `touch /tmp/foobar',
> you'll see that the command does not get executed at all.
>
> Thanks for any insight.

The reason is a bug in scsh that causes the REPL to hold the locks of
the command ports even though the REPL thread is not running any
more. The following patch fixes this:

Index: scsh.scm
===================================================================
RCS file: /cvsroot/scsh/scsh/scsh/Attic/scsh.scm,v
retrieving revision 1.46.2.4
diff -u -r1.46.2.4 scsh.scm
--- scsh.scm	24 Mar 2004 08:14:55 -0000	1.46.2.4
+++ scsh.scm	26 Apr 2006 09:36:53 -0000
@@ -1135,6 +1135,14 @@
 	     (if (zero? pid)				
 		 ;; Child
 		 (lambda ()		; Do all this outside the WITH-INTERRUPTS.
+                   (if narrow?
+                       (begin
+                         ;; ugly kludge:
+                         ;; the REPL thread is not running any more,
+                         ;; hence release its ports
+                         (release-port-lock (command-input))
+                         (release-port-lock (command-output))
+                         (release-port-lock (command-error-output))))
 		   ;; There is no session if parent was started in batch-mode
 		   (if (and (session-started?) clear-interactive?)
 		       (set-batch-mode?! #t)) ; Children are non-interactive.

Thanks for the report!

-- 
Martin