<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Emacs by default allocates a pty for subprocesses. There’s no way to do this portably, as many Lisps don’t support it, so UIOP won’t help you here. If you’re on SBCL and portability is not a concern, you can use <span style="font-family: "Andale Mono"; font-style: normal;" class="">sb-ext:run-program</span><span style="font-style: normal;" class=""> with a </span><span style="font-family: "Andale Mono"; font-style: normal;" class="">:pty</span> keyword argument, as described in section 7.7.3 of the SBCL manual. Failing that, it’s probably best to use <span style="font-family: "Andale Mono"; font-style: normal;" class="">sudo -S</span><span style="font-style: normal;" class="">.</span><div class=""><br class=""></div><div class="">phoebe<br class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 12, 2021, at 10:01 AM, Pierre Neidhardt <<a href="mailto:mail@ambrevar.xyz" class="">mail@ambrevar.xyz</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="content-isolator__container">Hi!<br class=""><br class="">I'd like to run a "sudo" command from Common Lisp.  The following works:<br class=""><br class="">--8<---------------cut here---------------start------------->8---<br class="">(uiop:launch-program '("sudo" "-S" "ls" "/root") :input :stream :output *standard-output*)<br class="">(format (uiop:process-info-input #v1) "MY-PASSWORD~%")<br class="">(finish-output (uiop:process-info-input #v1))<br class="">--8<---------------cut here---------------end--------------->8---<br class=""><br class="">Note that I'm using the "-S" parameter of sudo.  From the man page:<br class=""><br class=""><blockquote type="cite" class="">Write the prompt to the standard error and read the password<br class="">from the standard input instead of using the terminal device.<br class=""></blockquote><br class="">Without it, "sudo" terminate immediately.<br class=""><br class="">Somehow, Emacs _does_ support calling the sudo process without the "-S"<br class="">flag.  Try this:<br class=""><br class="">--8<---------------cut here---------------start------------->8---<br class="">(make-process :name "dummy" :command '("sudo" "ls" "/root"))<br class="">--8<---------------cut here---------------end--------------->8---<br class=""><br class="">and the "sudo" process is kindly waiting for input in the background.<br class=""><br class="">Any idea why that is?<br class="">Is it be possible to do the same in Common Lisp?<br class=""><br class="">Cheers!<br class=""><br class="">-- <br class="">Pierre Neidhardt<br class=""><a href="https://ambrevar.xyz/" class="">https://ambrevar.xyz/</a><br class=""></div></div></div></blockquote></div><br class=""></div></div></body></html>