OK, I perused the chicken-core git repo. posixunix.scm defines the 'process' procedure. It's a wrapper for the 'process-impl' procedure in the same file. process-impl does a lot of setup, then:

  (chicken.process#process-fork
    (lambda ()
      ;; ...set up input and output pipes...
      (chicken.process#process-execute cmd args env)))

And chicken.process#process-execute is also defined in the same file. I presume it's the execve() wrapper. The execve() error is handled in it as follows:

   (when (fx= r -1)
     (posix-error #:process-error 'process-execute
                  "cannot execute process" filename))

If 'process-execute' is run from within 'process', then 'process-execute' is running in the forked child process, and the above error is also signaled in that child process instead of the parent.

Since the code that caused the bug for me had my own 'condition-case' exception handler wrapped around the 'process' call, it would catch an exception in the child process, not in the parent.

And since normal control flow proceeds after a 'condition-case' exception handler has run, the forked child would continue running my Scheme program concurrently with the parent!

Probably you should change the implementation of 'process' so it calls a version of 'process-execute' that's specialized to run inside a child process forked with the sole purpose of "execve() or die trying" :)

_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to