[phobos] popen/pclose and bug 3157
Lars Tandle Kyllingstad
lars at kyllingen.net
Thu Sep 9 04:43:25 PDT 2010
On Thu, 2010-09-09 at 01:22 -0700, Brad Roberts wrote:
> On 9/9/2010 12:59 AM, Lars Tandle Kyllingstad wrote:
> > On Wed, 2010-09-08 at 13:52 -0700, Brad Roberts wrote:
> >> On Wed, 8 Sep 2010, Lars Tandle Kyllingstad wrote:
> >>> On Wed, 2010-09-08 at 02:14 -0700, Brad Roberts wrote:
> >>>> I know that a major rework of std.process is a work in progress. What's the
> >>>> state of it? I have a need, right now, for being able to execute a command and
> >>>> getting back both it's output and its exit code.. and it needs to work on all
> >>>> platforms.
> >>>
> >>> The current status is that the POSIX version works, and has done so for
> >>> a while. Its incorporation in Phobos, and development of the Windows
> >>> implementation, has been blocked by a DMD bug which is now fixed in SVN.
> >>>
> >>> So I guess the next steps will be
> >>> 1. Wait for next DMD release, which will contain aforementioned fix.
> >>> 2. Finish up Windows version.
> >>> 3. Code review and hopefully acceptance in time for following release.
> >>> [ 4. Deprecation and subsequent death of File.popen(). ;) ]
> >>>
> >>> -Lars
> >>
> >> Would you point me to the docs for the new version?
> >
> >
> > Sure:
> >
> > http://kyllingen.net/code/ltk/doc/process.html
> >
> > -Lars
> >
>
> Thanks.. I like the looks of it. spawnProcess looks like exactly what I'd love
> to have right now. :)
>
> I didn't read super closely, but some things that I noticed:
>
> In enum Redirect, you might want to change 'all' to 'allstd' or something. Also,
> you might want to generally comment about what's done with fd's NOT in the 0..2
> (inclusive) range.
It is mentioned in the spawnProcess() docs -- see the 'Note' section.
> You have such a rich set for spawnProcess that the omission of a form of
> pipeProcess, pipeShell, execute, and shell that also takes an env array stands out.
I did consider it, but for completeness that would mean not just one,
but two more forms of pipeProcess() and execute(). Example:
// Already there:
execute(command)
execute(exe, args)
// Add these?
execute(command, env)
execute(exe, args, env)
It just seemed a bit too much for what I believed to be a rare need. If
there is a real need for this, though, I don't have any problems with
adding it.
-Lars
More information about the phobos
mailing list