Not a very nice solution, but if your routine is now returning a pid of the shell rather than the parent textmate, you can query it from bash, then the PPID should be the TM pid

$ ps -lp62651
  UID   PID  PPID        F CPU PRI NI       SZ    RSS WCHAN     S             ADDR TTY           TIME CMD
  501 62651   250     4084   0  48  0  3708212  48356 -      S                   0 ??         0:02.11 /Applications/TextMate.app/Contents/MacOS/TextMate

This would be stable *even* if it was possible to run more than one instance of TM. 

But are you sure this is even possible? 
I could not get TM to use more than one instance, even trying various things from the commandline







On 14 November 2014 20:47, John DeSoi <desoi@pgedit.com> wrote:
With Textmate 1.5 I used the parent process ID from my bundle script (PHP posix_getppid) in order to store some per-session variables. With 2.0, the same function returns a different value for each script execution in the same session. I realize I could query the system and find the Textmate pid by name, but there could be more than one instance running. Is there a better way to get a stable identifier that only changes if the application is relaunched?

Thanks,

John DeSoi, Ph.D.



_______________________________________________
textmate mailing list
textmate@lists.macromates.com
http://lists.macromates.com/listinfo/textmate