Hello all, Last night I was trying to do the equivalent of this:
bash$ echo "foo" | sha512sum in guile. But I was unable to find a clear way to do it. I tried something like: (let* ((port (open-pipe* OPEN_BOTH "sha256sum" "--binary"))) (display "test me\n" port) (force-output port) (let ((result (drain-input port))) (close-port port) (car (string-split result #\space)))) Unfortunately, this just hangs forever at the drain-input. I get the same issue if I do (read-line port). What I expected was that Guile would provide a way to access stdin, stdout, stderr in a process as separate ports. Python provides an API more or less like this: >>> from subprocess import Popen, PIPE >>> proc = Popen("sha256sum", stdin=PIPE, stdout=PIPE) >>> proc.stdin.write(b"foo") 3 >>> proc.stdin.close() >>> proc.stdout.read() b'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae -\n' It looks like in the past there were discussions about doing something similar: http://comments.gmane.org/gmane.lisp.guile.user/9300 It might be really nice if there was a way to access stdin, stdout, and stderr as separate ports. I might be willing to write some code for it, if someone could point me in the right direction. But I really don't know where to look. Is there a way to do this that I don't know? Thanks for the help! - Chris