From: luhux <luhux@outlook.com>
To: guile-user@gnu.org
Subject: Questions about (open-input-output-pipe
Date: Tue, 10 Nov 2020 08:29:38 +0000 [thread overview]
Message-ID: <PSXP216MB0214A54B8933A76967AC3E20A0E90@PSXP216MB0214.KORP216.PROD.OUTLOOK.COM> (raw)
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
next reply other threads:[~2020-11-10 8:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 8:29 luhux [this message]
2020-11-10 14:27 ` Questions about (open-input-output-pipe Neil Jerram
2020-11-11 17:32 ` Timothy Sample
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PSXP216MB0214A54B8933A76967AC3E20A0E90@PSXP216MB0214.KORP216.PROD.OUTLOOK.COM \
--to=luhux@outlook.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).