www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [RFC] Modules for processes manipulation

reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
I'd like to see in D something like .Net's `System.Diagnostics.Process` 
and friends. Reasons:

* .Net's API looks really good and user friendly

Consider these processes manipulation modules:
http://denis-sh.github.com/hooking/hooking.windows.process.html
and hooking.windows.{thread|processmemory|processstartinfo}
Differences from .Net's:
* RAII (i.e. no handle leaking)
* do not cache process properties (see Appendix)
* able to launch with argument strings array, not only command line
* able to work with process memory
     Tip: a good way to to access current process memory without 
`Exception`s thrown on failure instead of `Error`s.

Currently it misses some features and is Windows-only.
So the questions are:
* Should I add missed features for Windows realisation (i.e. is it needed)?
* Should I create a cross-platform realisation (i.e. is it needed)?
* Will it be possibly accepted in Phobos?


Appendix about .Net's `Process`:
All properties are cached. And it is documented only in MSDN article 
about `Refresh` member function. So one has to remember this fact and be 
careful with this tricky .Net. E.g. one shouldn't believe words like 
"representing the operating system threads currently running in the 
associated process" from `Threads` property docs and remember it's cached.

-- 
Денис В. Шеломовский
Denis V. Shelomovskij
Nov 25 2012
parent reply =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 26-11-2012 08:02, Denis Shelomovskij wrote:
 I'd like to see in D something like .Net's `System.Diagnostics.Process`
 and friends. Reasons:

 * .Net's API looks really good and user friendly

 Consider these processes manipulation modules:
 http://denis-sh.github.com/hooking/hooking.windows.process.html
 and hooking.windows.{thread|processmemory|processstartinfo}
 Differences from .Net's:
 * RAII (i.e. no handle leaking)
 * do not cache process properties (see Appendix)
 * able to launch with argument strings array, not only command line
 * able to work with process memory
      Tip: a good way to to access current process memory without
 `Exception`s thrown on failure instead of `Error`s.

 Currently it misses some features and is Windows-only.
 So the questions are:
 * Should I add missed features for Windows realisation (i.e. is it needed)?
 * Should I create a cross-platform realisation (i.e. is it needed)?
 * Will it be possibly accepted in Phobos?


 Appendix about .Net's `Process`:
 All properties are cached. And it is documented only in MSDN article
 about `Refresh` member function. So one has to remember this fact and be
 careful with this tricky .Net. E.g. one shouldn't believe words like
 "representing the operating system threads currently running in the
 associated process" from `Threads` property docs and remember it's cached.
See: https://github.com/kyllingstad/phobos/tree/new-std-process -- Alex Rønne Petersen alex lycus.org http://lycus.org
Nov 26 2012
parent Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
26.11.2012 17:13, Alex Rønne Petersen пишет:
 See: https://github.com/kyllingstad/phobos/tree/new-std-process
Yes, I know about it. That's one of the reasons my code doesn't contain any stream redirection as I hope we may join work. -- Денис В. Шеломовский Denis V. Shelomovskij
Nov 26 2012