[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Questions about (open-input-output-pipe
From: |
luhux |
Subject: |
Questions about (open-input-output-pipe |
Date: |
Tue, 10 Nov 2020 08:29:38 +0000 |
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
- Questions about (open-input-output-pipe,
luhux <=