Mike Hansen wrote:
On Fri, Mar 12, 2010 at 12:09 AM, Dan Drake <dr...@kaist.edu> wrote:
I'm looking over #8486 and the patch there tests to see if the xelatex
program is available with

   os.system('which xelatex >/dev/null')

See http://trac.sagemath.org/sage_trac/ticket/8474 which was just merged :-)

--Mike

To summerise what is a long and sometimes confusing thread (I added to the confusion):

 * 'which' is not a POSIX command, so you can't even rely on it existing.
* 'which' exists on Solaris 10 with a code of 0 irrespective of whether that command is found. The Solaris 10 man pages do not discuss exit codes at all. * 'which' on OpenSolaris exits with an exit code of 1 if the command is not found, and 0 if it is. This is again documented in the OpenSolaris man pages. * This shows one of the problems of using commands (such as 'which') when they are not defined by POSIX - the implementation can be different on different systems. * 'command -v' is a POSIX command for determining if a program exits or not, and if so its path.


drkir...@hawk:~$ command -v ls
/usr/bin/ls
drkir...@hawk:~$ command -v jewewhjkhjkhtgkjgbtkjsdbkwd
drkir...@hawk:~$

I would however redirect standard error to /dev/null, as on at least one system there is an error message that jewewhjkhjkhtgkjgbtkjsdbkwd does not exist.

* John Palmieri has written a library function for Sage, called "have_program()" which determines if the program exists. It does not report it's path, as John did not need that information, but only whether it exists or not.

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to