[TxMt] Re: Session ID?
Allan Odgaard
mailinglist at textmate.org
Fri Nov 14 21:29:01 UTC 2014
On 14 Nov 2014, at 21:47, John DeSoi 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 was unable to reproduce that using the following command:
#!/usr/bin/php
<?php
echo posix_getppid() . "\n";
> 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?
TextMate sets TM_PID so you can use $_ENV['TM_PID']. Granted, we did
this only for the interactive input support which no longer exist, but I
see a few other things now rely on it, so should probably not remove it.
There is also TM_PROJECT_UUID and TM_DOCUMENT_UUID, which are meant as
“public API”, but those are per-project and per-document, so
they’ll live shorter than the session (but figured the info might be
useful in this context).
More information about the textmate
mailing list