CCL doesnot run shell command normally?
-
09-04-2021 - |
Domanda
? (run-program "ls" '() :output *standard-output*)
money.lisp
ssqHitNum.txt
ssqNum.txt
#<EXTERNAL-PROCESS (ls)[1019] (EXITED : 0) #x3867BACE>
? (run-program "tail ssqHitNum.txt" '() :output *standard-output*)
#<EXTERNAL-PROCESS (tail ssqHitNum.txt)[1020] (EXITED : 71) #x38679E56>
Why canot CCL run "tail ssqHitNum.txt" ?
Soluzione
As detailed in the docs, http://ccl.clozure.com/ccl-documentation.html#Running-Other-Programs-as-Subprocesses, you need to capture the output. This is one of the documented ways:
(with-output-to-string (s)
(ccl:run-program "ls" nil :output s))
The output is now contained in s and you can do whatever you want with it.
Altri suggerimenti
Try running it as:
(run-program "tail" '("ssqHitNum.txt") :output *standard-output*)
The second argument to run-program must contain the parameters.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow