www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17479] New: Public constructor for std.process.Pid

https://issues.dlang.org/show_bug.cgi?id=17479

          Issue ID: 17479
           Summary: Public constructor for std.process.Pid
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dhasenan gmail.com

I am trying to create a program that handles two types of processes:

* Scripts and executables that it runs directly
* Daemons that fork and exit, with a pid file containing the pid of the
lingering daemon process

I want to handle them in the same fashion. It would be convenient to use
std.process to do so.

I can easily parse an integer from a pid file, but in order to construct a
std.process.Pid from that, I need to resort to tupleof hacks and manually
constructing class instances.

It would be better if std.process.Pid exposed its constructors publicly.

For now, I'm using core.sys.posix directly. If I wanted to support Windows,
though, I'd have to copy std.process into my project and make the relevant
constructors public to handle things in a reasonable fashion.

--
Jun 07