"Ishan Arora":
> And is there a procedure to
> synchronously run a shell code and return the output as a String. Thanks.
> 

Should do:

(use-modules (ice-9 rdelim))

(define (get-system-output command)
  (let ((logfilename (tmpnam)))
    (system (string-append command " > " logfilename))
    (let* ((ret "")
           (fd (open-file logfilename "r"))
           (line (read-line fd)))
      (while (not (eof-object? line))
             (set! ret (string-append ret line))
             (set! line (read-line fd)))
      (close fd)
      (system (string-append "rm " logfilename))
      ret)))



Reply via email to