;+ ; H+ ; TITLE : get_session_id ; ; Author : Pamme Crandall ; Date : 07/18/06 ; ; $Date: 2006/07/19 00:40:17 $ ; $Source: /lasp/software/src/mm_tdp/src/get_session_id.pro,v $ ; @(#) $Revision: 1.1 $ ; $Name: version_2-2 $ ; $Locker: $ ; ; ; Purpose: ; Returns the process id of the session leader to which this ; idl session belongs ; Author: ; Chris Pankratz ; Date: ; 2 August 2002 ; ; ; CATEGORY: ; ; ; CALLING SEQUENCE: ; ; ; INPUT PARAMETERS: ; ; ; OPTIONAL KEYWORD PARAMETERS: ; ; RETURN VALUE: ; session_id - uniques string that belongs to current idl session ; ; COMMON BLOCKS: ; ; ; PROCEDURE: ; ; ;- ; MODIFICATIONS/REVISION LEVEL: ; MM/DD/YY WHO WHAT (most recent change first) ; ; H- ;------------------------------------------------------------------------------ function get_session_id common session_id, session_id if (n_elements(session_id) eq 0) then begin ;print, 'Getting session_id' ;spawn, 'ps -fj' ;spawn, 'echo "IDL Spawn process = $$"' ;spawn, 'echo $$', PID ;PID = PID[0] ;print, 'IDL Spawn Process = ' + PID spawn, "ps -o pid,sid | awk '$1 ~ /'$$'/ {print $2}'", session_id session_id = long(session_id[0]) print, 'IDL Session Process = ' + strtrim(session_id,2) endif return, session_id end