This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Immediate output instead of waiting for the script to finish

5 posts · 5234 views

Hi, everyone,

as I'm currently writing a long(ish) command-line tool in SBCL, I noticed that all output is queued until the script finishes or signals an unhandled condition. I'd prefer to see some "progress" though. Is there a way to force immediate output of (print)s and (format)s?
Does your runtime still barf JVM stack traces?

Re: Immediate output instead of waiting for the script to fi

There are functions for a buffer manipulation, force-output is probably what are you looking for.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.

Re: Immediate output instead of waiting for the script to fi

Looks exactly like what I want, thanks!

But I'm not quite sure about the difference between force-output and finish-output yet. Am I right that finish-output resets the buffer while force-output does not?
Does your runtime still barf JVM stack traces?

Re: Immediate output instead of waiting for the script to fi

finish-output is a blocking call and force-output is a non-blocking call.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.