I guess it's because "wg pubkey" has not yet seen EOF on its input, i.e. it doesn't know that the input is complete.
If that's right, I'm afraid I don't know how to fix it. Presumably you need a call that closes half of the port, but still allows reading the "wg pubkey" output from it. Alternatively, it might be buffering, i.e. the private key hasn't yet reached "wg pubkey". In that case (force-output port) might help. Best wishes, Neil On Tue, 10 Nov 2020 at 08:51, luhux <lu...@outlook.com> wrote: > 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 > >