Why does TeXShop run with COMMAND_MODE set to legacy and not unix2003?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why does TeXShop run with COMMAND_MODE set to legacy and not unix2003?

Ramón Figueroa-Centeno
Aloha,

Why does TeXShop run with COMMAND_MODE set to legacy and not unix2003?

If you don't know what I am talking about see <http://developer.apple.com/mac/library/releasenotes/Darwin/RN-Unix03Conformance/index.html>

So in Leopard and newer scripts that run in the Terminal will not run as engines from within TeXShop.

Ramón
Reply | Threaded
Open this post in threaded view
|

Re: Why does TeXShop run with COMMAND_MODE set to legacy and not unix2003?

Ramón Figueroa-Centeno
Aloha,

So the reason is so that TeXShop be compatible with OS X 10.4. So when developing engines (say in bash) set COMMAND_MODE=legacy at the top so that your engine behaves like it would in TeXShop.

Macros where you use "do shell script" are trickier. If on OS X 10.5 or greater you run the following code from the Applescript Editor

--Applescript direct
tell application "TeXShop" to display dialog (do shell script "echo $COMMAND_MODE")

you will get a dialog saying "unix2003", but if you paste it in a TeXShop macro (in the Macros menu) and run it you will get a dialog saying "legacy".

The fix is to add "COMMAND_MODE=legacy;" at the beginning of any "do shell script" statement, in our example

--Applescript direct
tell application "TeXShop" to display dialog (do shell script "COMMAND_MODE=legacy; echo $COMMAND_MODE")

The commands whose behavior has changed are: awk, echo in bash, exit, chown, cp, crontab, date, df, du, ex, vi, view, vim, file, grep, join, less, more, ls, mkfifo, mv, pr, ps, sed, sort, stty, uudecode, uuencode, who and xargs. See <http://developer.apple.com/mac/library/releasenotes/Darwin/RN-Unix03Conformance/index.html> for details.

Mahalo for you patience,

Ramón