guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in system?


From: Ludovic Courtès
Subject: Re: Bug in system?
Date: Wed, 07 Nov 2012 16:06:08 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Hi,

Keith Wright <address@hidden> skribis:

>  > (define y (with-output-to-string (lambda()(system "date"))))
>   Tue Nov  6 21:42:41 EST 2012
>  > y
>   $2 = ""
>
> The stdout of the system call does not go into the string,
> why not?

As Daniel said, this doesn’t work currently.

Instead, you would use the (ice-9 popen) module for that:

  scheme@(guile-user)> (use-modules (ice-9 popen) (ice-9 rdelim))
  scheme@(guile-user)> (define p (open-input-pipe "date"))
  scheme@(guile-user)> (read-line p)
  $7 = "Wed Nov  7 16:05:02 CET 2012"
  scheme@(guile-user)> (close-pipe p)
  $8 = 0

Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]