comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Test if a linux command is available with Spawn
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Test if a linux command is available with Spawn [message #86211 is a reply to message #86173] Thu, 17 October 2013 11:30 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 10/16/13 8:12 AM, Phillip Bitzer wrote:
> How about spawning "which", which should fairly standard on *nix:
>
> spawn, 'which xclip', result
>

I would check the EXIT_STATUS on "which xclip":

IDL> spawn, 'which xclip', stdout, stderr, exit_status=xclip_error
IDL> help, xclip_error
XCLIP_ERROR LONG = 1

Error code not 1 means there was a problem, in this case I don't have
xclip. If I have the program, it's like this:

IDL> spawn, 'which ls', stdout, stderr, exit_status=ls_error
IDL> help, ls_error
LS_ERROR LONG = 0

In this case, I don't need stdout/stderr output, but calling SPAWN with
them suppresses output to the output log.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NaN problem in integer arrays
Next Topic: Where does catalyst call the catEventDispatcher?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 07:29:17 PDT 2025

Total time taken to generate the page: 1.04139 seconds