[Openmcl-devel] patch: flush *terminal-io* when QUITting and other stuff

Gary Byers gb at clozure.com
Tue Jun 7 02:35:00 PDT 2005



On Mon, 6 Jun 2005, James Bielman wrote:

> Hi,
>
> I often have little scripts that I want to run with 'openmcl --load'
> and I always forget that (quit) doesn't seem to flush terminal output
> before exiting.  Here's a little patch that flushes *TERMINAL-IO*:
>
> Index: l1-readloop.lisp
> ===================================================================
> RCS file: /usr/local/tmpcvs/ccl-0.14/ccl/level-1/l1-readloop.lisp,v
> retrieving revision 1.7
> diff -u -r1.7 l1-readloop.lisp
> --- l1-readloop.lisp	14 Mar 2005 11:58:52 -0000	1.7
> +++ l1-readloop.lisp	7 Jun 2005 04:29:33 -0000
> @@ -119,6 +119,7 @@
> 			 #'(lambda ()
> 			     (process-exit-application *current-process*
> 				   #'(lambda ()
> +				       (finish-output *terminal-io*)
> 				       (#_exit exit-status)))))
>       (unless (eq cp ip)
> 	(process-kill cp)))))
>
> Also, when I remember to try it, I've attempted to use the '--batch'
> flag to get OpenMCL to quit after running a script, but I can't seem
> to figure out how to use it.  Using 'openmcl --batch --load foo.lisp'
> or so instead of writing '#+openmcl (quit)' would be handy.

I think that some of the problems here may bave to do with the fact
that *STANDARD-OUTPUT* and *TERMINAL-IO* are decoupled when --batch
is in effect.

shell> openmcl -n --eval '(progn (print "Yow!") )' --batch

printed a prompt and didn't seem to generate any output.  I finally
tried:


? ()
? (force-output)

"Yow!"
Welcome to OpenMCL Version (Beta: Darwin) 0.14.3-050603!
NIL
?

which wasn't exactly what I'd expected.

It wouldn't hurt anything to always do a FORCE-OUTPUT to
*STANDARD-OUTPUT* before quitting, but it looks like there may be some
other confusion here as well.

>
> Another startup thing---some time ago I tweaked my Lisp kernel to
> remove the shortcut of using argv[1] (when argc is 2) as the Lisp
> image name instead of -I when an embedded image is present.  I
> couldn't figure out otherwise how to make a "standalone executable"
> that took a single argument.
>
> If this sounds like a good idea I can try to find that installation
> and send a patch.

I think that the shortcut is sort of an historical accident, and
requiring -I in all cases seems a little cleaner in hindsight.

Maybe the right approach is to adopt your solution and deprecate
the use of the shortcut for a release or two, then eventually require
-I even in cases like:

shell> ./dppccl -I ppc-boot.image

Thanks.

>
> James
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list