digitalmars.D.learn - check for running process
- Dsmith (4/4) Oct 05 2011 In the core.thread library, there is a method isRunning() which takes a ...
- Steven Schveighoffer (10/16) Oct 05 2011 It cannot. isRunning checks a local boolean, it does not do any OS
- Regan Heath (7/24) Oct 05 2011 .. on unix systems. :p
- Kagamin (3/4) Oct 05 2011 There's an open standard for this:
In the core.thread library, there is a method isRunning() which takes a thread. To make code more portable, rather than use a system call or getenv(), how might isRunning() be adapted to check if a program is running? Ideally: isrunning(program_name);
Oct 05 2011
On Wed, 05 Oct 2011 10:38:58 -0400, Dsmith <Dsmith nomail.com> wrote:In the core.thread library, there is a method isRunning() which takes a thread. To make code more portable, rather than use a system call or getenv(), how might isRunning() be adapted to check if a program is running? Ideally: isrunning(program_name);It cannot. isRunning checks a local boolean, it does not do any OS queries. Now, once you have a reference to a running process, I'd say it's probably possible to add isRunning methods that call on the OS functions. Given a process ID, getting information about the process is pretty straightforward. I think this might be a good addition to std.process if it's not already in there. It's just the getting of the pid based on the name is not straightforward. -Steve
Oct 05 2011
On Wed, 05 Oct 2011 16:05:02 +0100, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Wed, 05 Oct 2011 10:38:58 -0400, Dsmith <Dsmith nomail.com> wrote:.. on unix systems. :p In the past I've had to parse "ps" output on various platforms. On Windows it's a great deal easier. -- Using Opera's revolutionary email client: http://www.opera.com/mail/In the core.thread library, there is a method isRunning() which takes a thread. To make code more portable, rather than use a system call or getenv(), how might isRunning() be adapted to check if a program is running? Ideally: isrunning(program_name);It cannot. isRunning checks a local boolean, it does not do any OS queries. Now, once you have a reference to a running process, I'd say it's probably possible to add isRunning methods that call on the OS functions. Given a process ID, getting information about the process is pretty straightforward. I think this might be a good addition to std.process if it's not already in there. It's just the getting of the pid based on the name is not straightforward.
Oct 05 2011
Steven Schveighoffer Wrote:It's just the getting of the pid based on the name is not straightforward.There's an open standard for this: http://en.wikipedia.org/wiki/Common_Information_Model_%28computing%29
Oct 05 2011