What do people recommend to execute unix programs from
within a lisp program.
I.e., how can i write a lisp function which calls
a named UNIX executable with a list of command line arguments,
and returns an object/data-structure/list which describe the
exit status, lines of stdout, lines of stderr, whether the
program dumped a core etc....
I'm mainly using CMUCL, and i've seen the page
http://common-lisp.net/project/cmucl/doc/cmu-user/unix.html#toc230
which appears fairly low level. Do i have to write such a function
as i'm describing with these low level system calls. Do i have to
handle forking myself and waiting and reaping the children? Or is
there an easier way?
-jim
On Thu, 18 Nov 2004 19:51:47 +0100, Jim Newton <·····@rdrop.com> wrote:
> What do people recommend to execute unix programs from within a lisp
> program.
>
> I.e., how can i write a lisp function which calls a named UNIX
> executable with a list of command line arguments, and returns an
> object/data-structure/list which describe the exit status, lines of
> stdout, lines of stderr, whether the program dumped a core etc....
>
> I'm mainly using CMUCL, and i've seen the page
> http://common-lisp.net/project/cmucl/doc/cmu-user/unix.html#toc230
> which appears fairly low level. Do i have to write such a function
> as i'm describing with these low level system calls. Do i have to
> handle forking myself and waiting and reaping the children? Or is
> there an easier way?
<http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc46>
Edi.
--
Lisp is not dead, it just smells funny.
Real email: (replace (subseq ·········@agharta.de" 5) "edi")
hey that function sure beats the &^&* out of perl's "system"
function huh?
-jim
Edi Weitz wrote:
> On Thu, 18 Nov 2004 19:51:47 +0100, Jim Newton <·····@rdrop.com> wrote:
>
>
>>What do people recommend to execute unix programs from within a lisp
>>program.
>>
>>I.e., how can i write a lisp function which calls a named UNIX
>>executable with a list of command line arguments, and returns an
>>object/data-structure/list which describe the exit status, lines of
>>stdout, lines of stderr, whether the program dumped a core etc....
>>
>>I'm mainly using CMUCL, and i've seen the page
>>http://common-lisp.net/project/cmucl/doc/cmu-user/unix.html#toc230
>>which appears fairly low level. Do i have to write such a function
>>as i'm describing with these low level system calls. Do i have to
>>handle forking myself and waiting and reaping the children? Or is
>>there an easier way?
>
>
> <http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc46>
>
> Edi.
>
I'm taking a look at
<http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc46>
and i have some questions about the :status-hook.
It is a function that gets called automatically when my child process's
status changes. What happens if i have 100 child processes and many of
their statuses change at about the same time? Do i need to worry
about this? What if the status changes before i get finished
creating all my processes? What if the status-hook function is
running, and before it finishes another processes status changes?
Do i need to implement a locking mechanism myself to handle this
situation?
-jim
Jim Newton wrote:
> hey that function sure beats the &^&* out of perl's "system"
> function huh?
>
> -jim
>
> Edi Weitz wrote:
>
>> On Thu, 18 Nov 2004 19:51:47 +0100, Jim Newton <·····@rdrop.com> wrote:
>>
>>
>> <http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc46>
>>
>> Edi.
>>
>
On Thu, 18 Nov 2004 21:18:31 +0100, Jim Newton <·····@rdrop.com> wrote:
> I'm taking a look at
> <http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc46>
> and i have some questions about the :status-hook. It is a function
> that gets called automatically when my child process's status
> changes. What happens if i have 100 child processes and many of
> their statuses change at about the same time? Do i need to worry
> about this? What if the status changes before i get finished
> creating all my processes? What if the status-hook function is
> running, and before it finishes another processes status changes?
> Do i need to implement a locking mechanism myself to handle this
> situation?
That's most likely a question for the CMUCL mailing list.
--
Lisp is not dead, it just smells funny.
Real email: (replace (subseq ·········@agharta.de" 5) "edi")
Hi Jim,
Jim Newton <·····@rdrop.com> writes:
> What do people recommend to execute unix programs from
> within a lisp program.
>
> I.e., how can i write a lisp function which calls
> a named UNIX executable with a list of command line arguments,
> and returns an object/data-structure/list which describe the
> exit status, lines of stdout, lines of stderr, whether the
> program dumped a core etc....
ext:run-program does exactly this.
Bj�rn