Subject: bug#44612: Read standard input in `guix repl'

From: Pierre Neidhardt <[email-masked]>
Date: Sat, 14 Nov 2020 14:19:04 +0100

Hey Tobias,

Always good to have someone actually test the stuff :)

Tobias Geerinckx-Rice <[email-masked]> writes:

> So far this looks like an (SB)CL(-specific) bug, right?  Does it 
> happen anywhere else?  I tried Guile[0].

Maybe there was a misunderstanding, it's not about Common Lisp.
We can do easier than from Guile, i.e. from a shell:

--8<---------------cut here---------------start------------->8---
echo '(display "hello")' | guix repl
--8<---------------cut here---------------end--------------->8---

and... it works! O.o

OK, my bad then, I mistested somehow.

For future reference, it's also works in Common Lisp:

--8<---------------cut here---------------start------------->8---
> (with-input-from-string (s "(display \"foo\\n\")")
           (uiop:run-program '("guix" "repl") :input s :output t :error-output nil))
GNU Guile 3.0.4
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
foo

--8<---------------cut here---------------end--------------->8---

However this brings me to another issue: the program output is prefixed
with the REPL welcome message which is printed to stdout.

So ideally when we read from standard input we should not include the
welcome message.

Any clue how to do that?

-- 
Pierre Neidhardt
https://ambrevar.xyz/