#856 get process ID?

liamstask Tue 8 Dec 2009

Is there a way to get the pid of current process within Fantom? I tried running "echo $PPID" via sys::Process, but could not for the life of me figure out how to get the quoting correct so that it didn't just spit "$PPID" back out.

Might be a handy static on sys::Process

brian Tue 8 Dec 2009

The quoting rules should work just like java.lang.Process.

If someone knows how to do with a Java API, then we can add it (but I've never been able to figure it out)

tcolar Tue 8 Dec 2009

I looked for that in the past. There is no clean java solution to this.

List of alternative impl. here: http://blog.igorminar.com/2007/03/how-java-application-can-discover-its.html

DanielFath Tue 8 Dec 2009

Is there .Net solution for this?

helium Tue 8 Dec 2009

Is there .Net solution for this?

$PPID is the parent process ID? If so then no, .Net does not offer this (at least as far as I know). You'd have to use the WinAPI through P/Invoke.

Login or Signup to reply.