
Daniel Trebbien wrote:
Is there a way to further remove platform dependence in handling the "exit code"? You mean the WIFEXITED et al macros? We had a status class in previous Boost.Process versions which encapsulated the exit code. However the design of the class was not really cross-platform as member functions like exited() were clearly added for POSIX systems only and didn't make sense on Windows (exited() for example always returned true). Thus the question is what to make platform-independent if a concept doesn't exist on a platform. :-)
The existence of boost::status would also force to know more than one interface to the same values.
A while ago when I was thinking about this same problem, I considered using Windows' debugging mechanism (process creation flag DEBUG_ONLY_THIS_PROCESS) to obtain this information. I don't know if debugging a process will affect its execution in some way, or whether the performance will be substantially impacted, but it might be interesting to see if this approach would work.
IIRC, DEBUG_ONLY_THIS_PROCESS requires special privilege.