Age | Commit message (Collapse) | Author |
|
This allows us to reduce the code considerably because CHICKEN 6 now
has native process objects, so we don't need to keep our own version
of process tracking.
Note that we still need to keep our own list of child processes
created by "fork", because we want the automatic subprocess reaper to
be able to work in a thread. This means we still need to have a
central mapping of our own subprocesses to condition object so we can
signal the thread which is waiting.
After all I'm not so sure if this was such a great idea, but it's kind
of a neat feature that could be useful, so keep it for now.
|
|
After dup(2)ing an fd into another already existing fd, we can close
the original.
|
|
We would initially create a pipe, dup(2) that onto fd 1 in the forked
process and open an output port on the original fd. This resulted in
a pretty nasty bug: if the fd would be redirected (by number) later,
it would not affect the output port because that was set up to point
to the original fd.
Instead, open an output port to the newly set up stdout and close the
direct pipe port.
|
|
|
|
Signed-off-by: Peter Bex <peter@more-magic.net>
|
|
|
|
Signed-off-by: Peter Bex <peter@more-magic.net>
|
|
|
|
codebase)
|
|
|
|
|
|
one thread to forrward SIGHCLD to.
Signed-off-by: Peter Bex <peter@more-magic.net>
|
|
|
|
Thanks to Vasilij Schneidermann for providing an initial patch.
|
|
|
|
run*/string* does not exist, and run/string* doesn't raise an
exception on nonzero exit status.
|
|
|
|
Thanks to Joerg Wittenberger
|
|
|
|
Thanks to Diego "dieggsy" for pointing out this incongruity with
scsh-process.
|
|
|
|
This would cause the REPL to exit after calling (run/file ...)
because it reached EOF.
Strangely this didn't cause any issues in the tests. Still not
sure why this would be the case.
Reported by Diego "dieggsy"
|
|
|
|
Signed-off-by: Peter Bex <peter@more-magic.net>
|
|
|
|
This seems to be necessary so that condition-variable-broadcast! works
when the signal handler is running in the same thread as the waiting
thread.
|
|
We might have missed the one and only SIGCHLD event for the process
we're about to wait for, so attempt to reap it before entering the
condition variable wait loop.
Just in case, we always do this when we're woken up, so that we
can't accidentally miss the signal.
|
|
|
|
This would be otherwise kept in masked mode because the thunk is in
the dynamic extent of the dynamic-wind.
|
|
|
|
|
|
We do a fork, and immediately afterwards we insert a scsh-process
object into the pending processes table with the pid of the newly
created child process.
However, sigchld may arrive in between the fork and the insertion of
the scsh-process object into the pending process table. The sigchld
handler will reap the child process and attempt to update the pending
scsh-process object, but it can't find it yet because the insertion of
this object into the table happens after the fork, thus losing the
reaped child's exit status.
Then, if the program waits for the process after that, we enter an
infinite busy waiting loop that expects a sigchld to arrive and update
the object through the table, but that never happens because the child
has already been reaped.
|
|
|
|
Signed-off-by: Peter Bex <peter@more-magic.net>
|
|
Thanks to Jörg F. Wittenberger for the patch and test
|
|
|
|
Jörg F. Wittenberger)
|
|
|
|
|
|
|
|
ready yet
|
|
|
|
Signed-off-by: Peter Bex <peter@more-magic.net>
|
|
|
|
|
|
|
|
|
|
Thanks to Joerg Wittenberger
|
|
|
|
|