uiop:launch-program fails to run sudo without -S
Pierre Neidhardt
mail at ambrevar.xyz
Tue Jan 12 16:01:12 UTC 2021
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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 511 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20210112/c309b50f/attachment.sig>
More information about the asdf-devel
mailing list