[comp.lang.scheme.c] "system" procedure in MIT Scheme

jashley@loanshark.cs.indiana.edu (J. Michael Ashley) (01/25/91)

In article <9101251240.AA13337@faui29.informatik.uni-erlangen.de> tnhasbar@faui29.informatik.uni-erlangen.de (T. Hasbargen) writes:
>Hallo, Z"uricher !!
>
>Ich sitzt hier vor einer MIT-Scheme-Implementierung auf UNIX (HP-Rechner) und
>habe eine Frage :
>
>   WIE  kann ich von Scheme aus zum UNIX-OS einen Programmaufruf absetzen
>
>        (wie zum Beispiel  "rm *.com"  oder aehnlich) ,
>
>        der als neuer Prozess ausgefuehrt und auf den SCHEME bis zur
>        Beendigung wartet ?
>
>   COMMON-LISP stellt dafuer zB die Funktion "(system ...)" bereit.
>
>Fuer eine Antwort waere ich sehr dankbar,
>
>                             t. hasbargen

I don't know the answer to the question, but T. Hasbargen is asking if
there is a way, in MIT Scheme, to do the Chez Scheme and Common LISP
equivalent of (system "...").  For example, (system "rm *.com").

In particular, he needs it to start a new process to execute the command
and have MIT Scheme wait for the command to finish before proceeding.

He'd be very thankful for an answer.

markf@altdorf.ai.mit.EDU (01/26/91)

>> In article <9101251240.AA13337@faui29.informatik.uni-erlangen.de> tnhasbar@faui29.informatik.uni-erlangen.de (T. Hasbargen) writes:
>> >Hallo, Z"uricher !!

   ...

>> >                             t. hasbargen
>> 
>> I don't know the answer to the question, but T. Hasbargen is asking if
>> there is a way, in MIT Scheme, to do the Chez Scheme and Common LISP
>> equivalent of (system "...").  For example, (system "rm *.com").

If you are running under unix, MIT Scheme has (system "...") as a
primitive procedure. In order to use it you should do something like:

  (define system (make-primitive-procedure 'system))
  (system "...")

The following is the documentation string for "system":

  "Invoke sh (the Bourne shell) on the string argument.\n\
  Wait until the shell terminates, returning its exit status as an
  integer."

-Mark

jonl@lucid.COM (Jon L White) (01/30/91)

re: I don't know the answer to the question, but T. Hasbargen is asking if
    there is a way, in MIT Scheme, to do the Chez Scheme and Common LISP
    equivalent of (system "...").  For example, (system "rm *.com").

Just to set the record straight -- there is no SYSTEM function defined
for Common Lisp.  Individual vendors of Common Lisp systems may have
extended the functionality to include an equivalent facility, but
I don't know if any use the name SYSTEM. 

For example, Lucid Common lisp uses RUN-PROGRAM, which ports across all 
Unix platforms plus several others, but probably doesn't carry over well
into lots of other OOPS's (Obscure OPerating Systems -- ask me privately 
for titilating examples.)


-- JonL --