[RFC] Modules for processes manipulation
Denis Shelomovskij
verylonglogin.reg at gmail.com
Sun Nov 25 23:02:09 PST 2012
I'd like to see in D something like .Net's `System.Diagnostics.Process`
and friends. Reasons:
* probably, lots of D users was previously on C#
* .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
More information about the Digitalmars-d
mailing list