[Mono-list] Process.GetProcess()

mickeyf mickey at thesweetoasis.com
Thu Jan 24 00:02:55 UTC 2013

I need a simple app that checks whether a different one is running, and if
not, restarts it.

If I'm correctly understanding the replies to  this post
, and depending on who is correct, System.Diagnostics.Process.GetProcess()
can find either

1) processes started by the same user, or
2) processes started by mono 

...but not any arbitrary process.

I see it finds many processes, both system processes and me-as-a-user
processes, but NOT the other mono app which I have started in a different
terminal and which is the one a care about in this case. 

On the other hand, a simple script with something like "ps ax | grep
myappname" has no trouble apparently finding any and all processes,
including the process I'm looking for.

I can do what I need with a script but am puzzled as to why GetProcess()
behaves as it does. I understand that the parent/child relationship is
different in *nix than is typical in Windows for example, but if mono is
supposed to replicate the behavior of .NET, shouldn't it do so here? If it
can be done in a script surely it can be done in C#? Is there a particular
reason it wasn't?

I frequently find my self consulting the .NET documentation because the mono
docs so often say "Documentation for this section has not yet been entered."
but I'm getting nervous about how far to trust it.

What am I missing here?


View this message in context: http://mono.1490590.n4.nabble.com/Process-GetProcess-tp4658257.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list