[Mono-list] System.Diagnostics.Process

Loren Bandiera lorenb@mmgsecurity.com
Wed, 15 Sep 2004 14:19:08 -0400 (EDT)


I need to able to determine if a specific process is running.  So I took
at look at System.Diagnostics.Process and that seemed to be what I need. 
I wrote some sample code:

using System;
using System.Diagnostics;

public class ProcessTest {

        public static void Main () {

                Process [] localByName = Process.GetProcessesByName("init");
                foreach (Process proc in localByName) {
                        Console.WriteLine (proc.ProcessName);
                }

                Process localById = Process.GetProcessById(1);
        }
}

When I try and run this Process.GetProcessesByName seems to return an
empty array.  Process.GetProcessById throws an exception because it can't
find the process ID.

Looking around I found this bug report:
http://bugzilla.ximian.com/show_bug.cgi?id=51445

Raading about the bug it appears that the Process class can only get
process information for the current Mono shared memory space.  That would
make System.Diagnostics.Process un-usable for what I need to do.

The bug report implies this can't be fixed due to dependency issues.  Is
that correct?

-- 
Loren Bandiera, CISSP <lorenb@mmgsecurity.com>
MMG Security, Inc.