Win32 process spawning, POpen and Hugs, revisited

Scott Turner p.turner at computer.org
Wed Mar 17 20:45:05 EST 2004


On 2004 March 17 Wednesday 07:01, Simon Marlow wrote:
> On a related note, I recently implemented a System.Process library on
> Unix.  Source code attached.  The Windows implementation should be
> relatively straightforward. 

> I think this is a good platform-independent abstraction for process
> management.  What do others think?

The abstraction could use an option to control whether exiting or killing the 
parent process also terminates the child.

I'm not sure on what Windows foundation you are thinking of implementing this, 
but it's not easy to handle the command and arguments on the Win32 API.  The 
arguments are handled by the API as a raw string, so the caller must quote 
the arguments according to awkard (possibly undocumented) rules.  I've worked 
with this both in the Win32 API and using Perl. Perl didn't have it right, so 
in one case I was unable to invoke a certain command using the full pathname, 
because it contained spaces.

Nevertheless, supporting argument lists and command path names is the way to 
go.


More information about the Libraries mailing list