how about

(define (system->string . args)
    (string-chomp (with-input-from-pipe (string-join args " ") read-all)))

this is assuming that you meant that you want to construct a single command
from a list of strings.  if you wanted each string to be a separate command
it could look like:

(define (system->string . args)
    (apply conc
           (map
               (lambda (x)
                   (with-input-from-pipe x read-all))
               args)))

or if you wanted a list of cmds, where each cmd was either a string or a list
of string components:

(define (system->string . args)
    (apply conc
           (map
               (lambda (x)
                   (with-input-from-pipe
                       (if (string? x)
                           x
                           (string-join x " "))
                       read-all))
               args)))


granted, none of these do errorchecking or whatnot, but that should be trivial
to add.

-elf


On Mon, 14 Jan 2008, Zbigniew wrote:

Ozzi <[EMAIL PROTECTED]> writes:
I am using the following code, which just takes a single string:
(define (system->string cmd)
  (string-chomp (with-input-from-pipe cmd read-all)))

On Jan 14, 2008 1:45 PM, Kon Lovett <[EMAIL PROTECTED]> wrote:
See also http://galinha.ucpel.tche.br/Unit%20utils#system

system and system* do not capture the command output.


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users



_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to