> The 1st value returned by (subprocess) is an opaque reference to the > executing process. If you pass the reference to (subprocess-status) it > will return *'running* if the process currently is executing, or the > exit/error value. >
"exit/error value" is the issue there. (subprocess-status ps) will return 'running if the process is running. If it doesn't, either the process has never ran, either it has finished with a exit code. No way (that I see) to disambiguate. > No actual process can have pid 0 ... that value is reserved (on > Unix/Linux and Windows). > > Racket doesn't support fork (because Windows doesn't), but recall that > when you fork in Unix/Linux, the child process receives the illegal pid > value 0 so that it knows it is the child, while the parent receives the > real pid value for the child. > > Also note that (subprocess-pid) will be valid only if the process started > successfully. > > (subprocess-pid) is only valid when (subprocess-status) is 'running but testing the status then requesting the pid is not atomic, therefore subprocess-pid should return #f or raise. Or return pid 0 but it should be documented :) By the way there is a process with pid 0 on Linux, it's "sched". And on Windows, its "idle". Of course it could never be the result of (subprocess ...) but I don't want to rely on incidental behaviour from an API := > Hope this helps, > George > Thanks for contributing, it's much appreciated, Bertrand -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/f91e532a-182f-454e-8495-496a9c088e9f%40googlegroups.com.