unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Questions about (open-input-output-pipe
@ 2020-11-10  8:29 luhux
  2020-11-10 14:27 ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: luhux @ 2020-11-10  8:29 UTC (permalink / raw)
  To: guile-user

Hello everyone

I am a newbie to guile and I am learning to use guile to write scripts

I want to implement this shell command:


wg pubkey < private > public



This is a command to generate a key,
It inputs private key and EOF from stdin, then it outputs the public key and exits.

I implemented it using the following code in guile:



(use-modules (ice-9 popen)
             (ice-9 rdelim))

(define (wg-gen-private-key)
  (let* ((port (open-input-pipe "wg genkey"))
	(result (read-line port)))
    (close-pipe port)
    result))

(define (wg-gen-public-key private-key)
  (let ((port (open-input-output-pipe "wg pubkey")))
    (display private-key port)
    (let ((result (read-line port)))
      (close-port port)
      result)))


Then I executed the code to get the public key




scheme@(guile-user)> (wg-gen-public-key (wg-gen-private-key))




but the code got stuck in this place:




    (let ((result (read-line port)))




How should I do?

There are too few Guile information on the Internet. Sorry for asking such a basic question.

luhux



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-11 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  8:29 Questions about (open-input-output-pipe luhux
2020-11-10 14:27 ` Neil Jerram
2020-11-11 17:32   ` Timothy Sample

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).