#1904 Process class - Launching a Pod from Mac osx

yliu Thu 7 Jun 2012

I wrote code to restart a .pod in win32 with Process like so:

Process restart := Process(["fan.exe",podname], Env.cur.homeDir+`bin/`)
restart.run

but in Mac osx I know the executable is now just fan so I tried:

Process restart := Process(["fan",podname], Env.cur.homeDir+`bin/`)
restart.run

however, this returns an ".. java.io.IOException: Cannot run program "fan" (in directory "~/dev/fan/bin") error=2, No such file or directory.." .

I know the file is there and that the directory exists, so I'm a little stumped. Thoughts?

andy Thu 7 Jun 2012

I do something like that for Draft - might find my code useful for reference (which does work on OS X):

https://bitbucket.org/afrankvt/draft/src/5ff2dbc9ed36/src/fan/Dev.fan

You'll probably find the Java Process APIs sort of suck (which of course effects Fantom's APIs)

yliu Thu 7 Jun 2012

Hmmm.. so if I'm trying to run an fwt program, then I guess I have to put swt.jar in the cp too?

andy Thu 7 Jun 2012

Most likely - the fan bash script spawns two different processes - and killing the parent process will not actually kill the JVM process. Hence why I invoke the pod directly using java.

Login or Signup to reply.