Environment passed to Applications-launched processes
OK, I finally got around to testing this comprehensively on my system (10.5.5 and X11 2.3.1). Here's what I did, in detail: 1) I created a file .MacOSX/environment.plist containing two environment variables (TESTVARIABLE and TESTVARIABLE2). 2) In the X11 Applications menu, I created two entries: 'xterm -ls', and 'env > /tmp/X11_env.txt'. 3) I created an applescript in Script Editor containing the single line: do shell script "env > /tmp/Applescript_env.txt; cd $HOME; /usr/X11/ bin/xterm -ls" 4) I logged out and logged back in. Test 1: Launching from a Terminal 1) I opened a Terminal window. 'env | grep TEST': positive 2) In the terminal window, I typed 'xterm -ls' to open an xterm. In the resulting xterm, 'env | grep TEST': positive 3) Created a new xterm from the X11 Applications menu. In the resulting xterm, 'env | grep TEST': NEGATIVE 4) Created the /tmp/X11_env.txt file from the X11 Applications menu. 'grep TEST /tmp/X11_env.txt: NEGATIVE Test 2: Launching from Applescript 1) Opened Script Editor and ran the Applescript from there. (I could also save it as an Application; makes no difference.) 2) In the resulting xterm: 'env | grep TEST': positive 3) Created a new xterm from the X11 Applications menu. In the resulting xterm, 'env | grep TEST': NEGATIVE 4) Created the /tmp/X11_env.txt file from the X11 Applications menu. 'grep TEST /tmp/X11_env.txt: NEGATIVE 5) 'grep TEST /tmp/Applescript_env.txt: positive Test 3: Launch from the Utilities directory. 1) Launched X11 from the Utilities directory. This opened X11 and an xterm. 2) In the resulting xterm: 'env | grep TEST': positive 3) Created a new xterm from the X11 Applications menu. In the resulting xterm, 'env | grep TEST': positive 4) Created the /tmp/X11_env.txt file from the X11 Applications menu. 'grep TEST /tmp/X11_env.txt: positive I don't have an .xinitrc file. The only conclusion I can draw is that X11 is NOT picking up the environment.plist file when it auto-launches through the DISPLAY variable, but is when it launches from the Utilities directory. -G. -- Glenn Eychaner (geychaner@lco.cl) Telescope Systems Programmer, Las Campanas Observatory
And to make matters more interesting, variables set in your .bashrc will probably appear when you auto-launch, but not when you launch from the utilities directory. Thanks for the info, I'm looking into it and will try to figure out a solution. --Jeremy On Sep 25, 2008, at 07:10, Glenn Eychaner wrote:
OK, I finally got around to testing this comprehensively on my system (10.5.5 and X11 2.3.1). Here's what I did, in detail:
1) I created a file .MacOSX/environment.plist containing two environment variables (TESTVARIABLE and TESTVARIABLE2). 2) In the X11 Applications menu, I created two entries: 'xterm -ls', and 'env > /tmp/X11_env.txt'. 3) I created an applescript in Script Editor containing the single line: do shell script "env > /tmp/Applescript_env.txt; cd $HOME; /usr/X11/ bin/xterm -ls" 4) I logged out and logged back in.
Test 1: Launching from a Terminal 1) I opened a Terminal window. 'env | grep TEST': positive 2) In the terminal window, I typed 'xterm -ls' to open an xterm. In the resulting xterm, 'env | grep TEST': positive 3) Created a new xterm from the X11 Applications menu. In the resulting xterm, 'env | grep TEST': NEGATIVE 4) Created the /tmp/X11_env.txt file from the X11 Applications menu. 'grep TEST /tmp/X11_env.txt: NEGATIVE
Test 2: Launching from Applescript 1) Opened Script Editor and ran the Applescript from there. (I could also save it as an Application; makes no difference.) 2) In the resulting xterm: 'env | grep TEST': positive 3) Created a new xterm from the X11 Applications menu. In the resulting xterm, 'env | grep TEST': NEGATIVE 4) Created the /tmp/X11_env.txt file from the X11 Applications menu. 'grep TEST /tmp/X11_env.txt: NEGATIVE 5) 'grep TEST /tmp/Applescript_env.txt: positive
Test 3: Launch from the Utilities directory. 1) Launched X11 from the Utilities directory. This opened X11 and an xterm. 2) In the resulting xterm: 'env | grep TEST': positive 3) Created a new xterm from the X11 Applications menu. In the resulting xterm, 'env | grep TEST': positive 4) Created the /tmp/X11_env.txt file from the X11 Applications menu. 'grep TEST /tmp/X11_env.txt: positive
I don't have an .xinitrc file. The only conclusion I can draw is that X11 is NOT picking up the environment.plist file when it auto-launches through the DISPLAY variable, but is when it launches from the Utilities directory.
-G. -- Glenn Eychaner (geychaner@lco.cl) Telescope Systems Programmer, Las Campanas Observatory
_______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/xquartz-dev
participants (2)
-
Glenn Eychaner
-
Jeremy Huddleston