[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] Fixing the "process" procedure to be safe against
From: |
felix . winkelmann |
Subject: |
Re: [Chicken-hackers] Fixing the "process" procedure to be safe against execve() errors |
Date: |
Fri, 26 Jul 2019 23:12:42 +0200 |
> The the way things are done in the current version of Chicken is wonky
> because the outline is like this:
>
> child = fork();
> if (!child) {
> // This code runs in the child process.
> execve(exefile, argv, envp);
> // Not only is the errno value not returned to the parent,
> // but there is no call to exit() at all. So the child
> // keeps running the user's Scheme program after a failed
> // execve() until the program error-exits. Since the parent
> // also continues running the Scheme program, there are now
> // two copies of it running concurrently.
> }
>
If the execve fails, an exception is thrown - so doing that already indicates
that the user has something particular in mind. I understand that the situation
of having 2 different processes handling this scenario is rather icky, yet
it is essentially a UNIXism that one has to deal with, regardless of language
(which doesn't mean that it couldn't be improved, of course).
felix