Hi!
I'd like to run a "sudo" command from Common Lisp. The following works:
--8<---------------cut here---------------start------------->8---
(uiop:launch-program '("sudo" "-S" "ls" "/root") :input :stream :output *standard-output*)
(format (uiop:process-info-input #v1) "MY-PASSWORD~%")
(finish-output (uiop:process-info-input #v1))
--8<---------------cut here---------------end--------------->8---
Note that I'm using the "-S" parameter of sudo. From the man page:
Write the prompt to the standard error and read the password
from the standard input instead of using the terminal device.
Without it, "sudo" terminate immediately.
Somehow, Emacs _does_ support calling the sudo process without the "-S"
flag. Try this:
--8<---------------cut here---------------start------------->8---
(make-process :name "dummy" :command '("sudo" "ls" "/root"))
--8<---------------cut here---------------end--------------->8---
and the "sudo" process is kindly waiting for input in the background.
Any idea why that is?
Is it be possible to do the same in Common Lisp?
Cheers!
--
Pierre Neidhardt
https://ambrevar.xyz/