new std.process and "Win/DMC runtime issues"?

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 16 08:10:50 PST 2012


On Mon, 16 Jan 2012 02:49:33 -0500, Nick Sabalausky <a at a.a> wrote:

> The limitations of the current std.process are getting to be a big pain  
> in
> my ass for script-style programs. Last I heard, the new std.process was
> blocked by "issues with the DMC runtime prevent it from working on  
> Windows".
>
> What's up with that? Any news or any specifics? And more hopefully: Any
> workarounds to the windows issue so I could at least grab it and use it
> pre-acceptance-into-phobos?

I had a pull request into dmc, Walter said that he would merge it after  
this past release of dmd.  I did not see any emails, but looking at dmc,  
it looks like it's updated!  Don't know why I missed that email, maybe I  
glossed over it...

But here's the kicker :)  Building DMC is impossible (partly because its  
closed source, and partly because it requires obscure tools you can no  
longer obtain).

So we still have to wait for a release of DMC (or for D's version of  
snn.lib to be updated to include the fix).

Specifically, the issue is with pipes and EOF.  Since everything in D uses  
FILE *, so does the new std.process (not the best choice IMO, but we have  
no choices in this (yet) ).  But DMC's FILE * treats an EPIPE error as a  
EBADF, meaning the FILE* sets its error flag vs the EOF flag.

This means for instance, if you piped off a process to transform a file,  
and read it's stdout to completion, std.stdio.File would throw an  
exception.

The fix checks for the specific error and translates it to EOF.  It's  
somewhat of a hack, but it works.

If you are interested, I have a patched snn.lib with the fix in place if  
you want to try out the new version of std.process.  Send me an email.

-Steve


More information about the Digitalmars-d mailing list