chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Interaction of subprocess and condition handling


From: felix . winkelmann
Subject: Re: [Chicken-users] Interaction of subprocess and condition handling
Date: Fri, 19 Jul 2019 22:26:32 +0200

> How do you handle errors signaled by the 'process' procedure from the
> (chicken process) module in Chicken 5?
>
> When I try things like
>
>    (receive (from-child to-child child)
>        (condition-case
>            (process command args)
>          (_ ()
>             (values #f #f #f)))
>      ...)
>
> I get weird results - I have some 'display' calls, and according to
> 'current-process-id' some of them are coming from a different PID (I
> assume 'process' does fork/exec internally, so somehow some of the
> display code actually ends up running in the forked child process.
>
> I guess normally the unix execve() call succeeds so the child process
> stops running the Chicken programs and executes the desired command. But
> when execve() fails (e.g. due to a missing executable file) then the
> child process continues running Chicken code instead of exiting?

*Normally*, closing both ports returned from "process" will do a
waitpid(2) (or the equivalent) and throw an exception if WIFEXITED
returns false.

Somehow I can't make this work - may this be broken?


felix




reply via email to

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