unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Kjetil S. Matheussen" <k.s.matheussen@notam02.no>
To: guile-user@gnu.org
Subject: Re: X11 bindings and shell bindings
Date: Thu, 18 Sep 2008 18:54:09 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0809181851010.1013@notam02.uio.no> (raw)
In-Reply-To: <cmu-lmtpd-23352-1221754132-4@mail-imap1.uio.no>


"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	other threads:[~2008-09-18 16:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cmu-lmtpd-23352-1221754132-4@mail-imap1.uio.no>
2008-09-18 16:54 ` Kjetil S. Matheussen [this message]
2008-09-18 16:08 X11 bindings and shell bindings dsmich
2008-09-18 16:58 ` Neil Jerram
  -- strict thread matches above, loose matches on Subject: below --
2008-09-18 12:38 Ishan Arora
2008-09-18 13:52 ` Jon Wilson
2008-09-18 15:10   ` Ishan Arora
2008-09-18 17:01     ` JonWilson
2008-09-18 17:16 ` Paul Emsley
2008-09-18 18:43 ` Andy Wingo
2008-09-18 19:37   ` Linas Vepstas
2008-09-18 21:09     ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0809181851010.1013@notam02.uio.no \
    --to=k.s.matheussen@notam02.no \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).