guile-user
[Top][All Lists]
Advanced

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

Re: system call and results ...


From: Matthew R Wette
Subject: Re: system call and results ...
Date: Sat, 16 Sep 2000 08:20:51 -0700

David Pirotte writes ...
> Well, not really: I don't thing you understood my question, let me take an
> even simpler example:
> 
>         guile> (define date (system "date '+%d-%m-%Y'"))
>         16-09-2000
>         guile> date
>         0
> 
> you see, I want that 'date' gets bound to the result of the system call,
> not the shell exit code
> 
> i know this probably involves redefining output port and reading it, but i
> was hoping a simple example just to be quicker

Here is the def' from the source:

CM_DEFINE (scm_system, "system", 0, 1, 0,
  (SCM cmd),
  "Executes @var{cmd} using the operating system's \"command processor\".\n"
  "Under Unix this is usually the default shell @code{sh}.  The value\n"
  "returned is @var{cmd}'s exit status as returned by @code{waitpid}, which\n"
  "can be interpreted using the functions above.\n\n"
  "If @code{system} is called without arguments, it returns a boolean\n"
  "indicating whether the command processor is available.")

It looks to me like you need to hack on the output port.  If there
is not another routine to catch the output of system, there probably
should be (i.e., like Perl's back-quote operator!).

Matt




reply via email to

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