Open dfmorrison opened 6 years ago
What's (probably) happening here is CCL is consuming those arguments for itself before it ever passes them along. CCL itself has --debug
and -b
/--batch
arguments -- I suspect -d
is short for debug even though the usage information doesn't say that. If you do ./show-args -- ...
you should see all the arguments.
SBCL has a :save-runtime-options
flag to save-lisp-and-die
to prevent this kind of problem. I'm not sure if CCL has something similar.
Well, clozure's documentation lists ccl:*unprocessed-command-line-arguments*
which seems what one would want to use in unix-opts:argv.
While at it, I fixed it for abcl as well.
diff --git a/unix-opts.lisp b/unix-opts.lisp
index d557698..a03348d 100644
--- a/unix-opts.lisp
+++ b/unix-opts.lisp
@@ -190,11 +190,10 @@ printed in option description."
(defun argv ()
"Return a list of program's arguments, including command used to execute
the program as first elements of the list. Portable across implementations."
- #+abcl ext:*command-line-argument-list*
+ #+abcl (cons *load-truename* ext:*command-line-argument-list*)
#+allegro sys:command-line-arguments
- #+:ccl ccl:*command-line-argument-list*
+ #+ccl (cons *load-truename* ccl:*unprocessed-command-line-arguments*)
#+clisp (cons *load-truename* ext:*args*)
- #+clozure ccl:*command-line-argument-list*
#+cmu extensions:*command-line-words*
#+ecl (ext:command-args)
#+gcl si:*command-args*
@guenthert relevant https://github.com/Clozure/ccl/issues/177
Hmmh, yes, I didn't have system-images in mind at all (despite your comment earlier). The patch above helps ccl/clozure then only for files loaded and compiled on the fly ("scripts") until ccl's bug is fixed. Didier Verner describes in [1] how the same can be accomplished more generally by a (bourne) shell wrapper script.
Perhaps the documentation string of ARGV should be modified to make it clearer that arguments to the lisp interpreter/compiler itself are expected to be removed, if that approach is being taken.
[1] http://www.didierverna.net/blog/index.php?post/2011/01/22/Towards-ABCL-Standalone-Executables
It appears impossible to pass
-b
,-d
or--debug
to unix-opts, at least in CCL: