check for running process
Regan Heath
regan at netmail.co.nz
Wed Oct 5 08:30:39 PDT 2011
On Wed, 05 Oct 2011 16:05:02 +0100, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> On Wed, 05 Oct 2011 10:38:58 -0400, Dsmith <Dsmith at 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.
.. 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/
More information about the Digitalmars-d-learn
mailing list