How to get the shell function's output in slime?
-
07-07-2021 - |
Question
In REPL, we can get its output normally:
(shell "head -3 ~/misc.lisp")
(asdf:make-build 'stumpwm :type :program :monolithic t
:move-here "."
:name-suffix ""
However, we get nil from (shell "head -3 ~/misc.lisp")
in slime.
Sincerely!
Solution 2
use #'run-shell-command instead of shell:
(let ((str (ext:run-shell-command cmd :output :stream)))
(loop for line = (read-line str nil)
until (null line)
do (print line)))
it works now.
OTHER TIPS
I don't know which Lisp implementation you're using, but normally you should need a package to run shell command like:
- trivial-shell
- inferior-shell
- clesh (build on top of trivial-shell)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow