We have develloped a small multiplateform library in c++. Among other things there is a cmd launcher, roughly imagine these:
pid_t pid = Launch( wchar_t* cmd, [ wchar_t* stderr, wchar_t* stdout, wchar_t* stdin ] )
kill( pid_t pid ) // Kills the pgid
wait( pid_t pid , timeout t, bool kill ) // Kill after timeout or pass
...The problem is:
Our library users have noticed that, if they launch a graphical app without using open:
> wchar_t* cmd = myApp myArgs
instead of
> wchar_t* cmd = open myApp myArgs
Then many gui events would not wok properly. But there are a lot of problem with that:
- The pid returned is the one of open not the app launched
- Even using open -W killing the process group id of open does not kill the launched app
I have searched here
http://opensource.apple.com/release/os-x-10112/
http://opensource.apple.com/source/system_cmds/system_cmds-671.10.3/
http://opensource.apple.com/source/shell_cmds/shell_cmds-187/
As well as bash/zsh/tcsh...
I haven't been able to find the source code of the open command. I need to be able to simulate its "gui foreground" behaviour when the lib is ran on mac os x. Any idea is very welcome.
Cheers, and thanks to have read up to here already 🙂