rdmd and popen

Max Samukha samukha at voliacable.com.removethis
Sat Jan 17 10:39:03 PST 2009


On Sat, 17 Jan 2009 09:19:38 -0800, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:

>Max Samukha wrote:
>> On Sat, 17 Jan 2009 16:09:43 +0200, Max Samukha
>> <samukha at voliacable.com.removethis> wrote:
>> 
>>> rebuild is pretty unusable with dmd 2.023, so I've taken the liberty
>>> to port a popen implementation to D for Windows and modify rdmd to use
>>> that.
>>>
>>> The handle returned by the popen st
>> 
>> ..ill fails at the end of stream (maybe due to this issue
>> http://www.digitalmars.com/d/archives/c++/windows/32-bits/274.html),
>> so the exception is simply ignored for now.
>> 
>> The rdmd.d patch and popen are here
>> http://d-coding.com/download/rdmd.zip
>
>That's great! Is it ok with you if I take the popen implementation and 
>do the rdmd integration by hand? I made a couple of other changes to 
>rdmd and I'm not sure how patch would cope with that. Also, please let 
>me know if you allow me to change popen a bit to e.g make symbols more 
>local and add documentation. Finally, please let me know if I can 
>publish your implementation in Phobos and use it in other functions such 
>as shell().
>
>Thanks,
>
>Andrei

Yep. But there are numerous issues with this implementation

1. The bad descriptor error.
2. pclose is not implemented accoring to the standard. There is a way
to partially fix this by storing the process ID in the descriptor.
3. 0 is passed to the mode parameter of _open_osfhandle. It should
probably be _O_BINARY if the runtime cares at all.
4. This implementaion is based on a number of existing ones so the
owners of original versions may be bad enough to claim their rights.

So it's far from being a perfect popen :)


More information about the Digitalmars-d-announce mailing list