ccl icon indicating copy to clipboard operation
ccl copied to clipboard

CCL does not exit after evaluation with --batch option

Open galdor opened this issue 1 year ago • 5 comments

According to the documentation, --batch makes CCL exit on stdin EOF.

Running:

ccl --no-init --batch --quiet --eval '(format t "Hello world!~%")'

Leads to CCL printing the message correctly and hanging there without exiting until one hits ^D to explicitely send EOF. In this state, using ^C to send SIGINT causes CCL to enter the debugger (really not something expected with --batch_).

Stracing CCL shows that it is reading the standard input:

[pid 21446] write(1, "Hello world!\n", 13Hello world!
) = 13
[pid 21446] read(0,  <unfinished ...>

I would expect CCL to exit after all forms passed to --eval options have been evaluated.

Environment: CCL 1.12.2 running on Linux x86_64.

galdor avatar Dec 26 '23 13:12 galdor

If it's meaningful in any way, sbcl --script doesn't quit without a manual ^D either, and requires an explicit (sb-ext:quit) call in its eval chain.

For CCL, is adding --eval '(ccl:quit)' at the end satisfying?

phoe avatar Dec 26 '23 13:12 phoe

SBCL absolutely exits after loading and evaluating a file with --script. Tested 5s ago with sbcl --script /tmp/test.lisp and a file containing (format t "Hello world!~%"). Same thing with sbcl --no-userinit --non-interactive --eval '(format t "Hello world!~%")' (the fact that it prints this stupid banner is another problem), as it should be.

galdor avatar Dec 26 '23 13:12 galdor

If we give it what it's asking for, it does what it's supposed to do:

echo |ccl --no-init --batch --quiet --eval '(format t "Hiya!~%")'

;)

metayan avatar Dec 26 '23 13:12 metayan

Welp, I launched sbcl --script in a terminal, at which point it was reading from standard input, which needed a manual ^D.

I assume then this is a feature request for a ccl --script-like syntax that accepts a filename, loads it, and then exits.

I would expect CCL to exit after all forms passed to --eval options have been evaluated.

I meant sbcl --eval '(format t "Hello world!")' which doesn't quit, apologies for the confusion.

phoe avatar Dec 26 '23 13:12 phoe

CCL should absolutely have --script to avoid having to provide --no-init --batch --quiet, but --batch should absolutely result in CCL exiting after having processed --load and --eval options (more precisely after code evaluated due to these options has terminated).

galdor avatar Dec 26 '23 14:12 galdor