From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rixed@happyleptic.org Newsgroups: gmane.lisp.guile.user Subject: Re: execlp Date: Wed, 23 Nov 2011 15:03:31 +0100 Message-ID: <20111123140331.GB3674@ccellier.rd.securactive.lan> References: <4ECBC87E.7090000@bioch.ox.ac.uk> <4ECCE42F.8030404@bioch.ox.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1322057037 28557 80.91.229.12 (23 Nov 2011 14:03:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 23 Nov 2011 14:03:57 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Nov 23 15:03:53 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RTDQW-0003vJ-NN for guile-user@m.gmane.org; Wed, 23 Nov 2011 15:03:52 +0100 Original-Received: from localhost ([::1]:35400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTDQW-0005yE-36 for guile-user@m.gmane.org; Wed, 23 Nov 2011 09:03:52 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:60657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTDQO-0005xX-G9 for guile-user@gnu.org; Wed, 23 Nov 2011 09:03:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTDQH-0006VW-VT for guile-user@gnu.org; Wed, 23 Nov 2011 09:03:43 -0500 Original-Received: from eneide.happyleptic.org ([213.251.171.101]:57753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTDQH-0006Tv-PR for guile-user@gnu.org; Wed, 23 Nov 2011 09:03:37 -0500 Original-Received: from extranet.securactive.org ([82.234.213.170] helo=ccellier.rd.securactive.lan) by eneide.happyleptic.org with esmtp (Exim 4.72) (envelope-from ) id 1RTDXP-0005zH-2K for guile-user@gnu.org; Wed, 23 Nov 2011 15:10:59 +0100 Original-Received: from rixed by ccellier.rd.securactive.lan with local (Exim 4.72) (envelope-from ) id 1RTDQB-0008Ti-DI for guile-user@gnu.org; Wed, 23 Nov 2011 15:03:31 +0100 Mail-Followup-To: rixed@happyleptic.org, guile-user@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 213.251.171.101 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8982 Archived-At: -[ Wed, Nov 23, 2011 at 08:28:56PM +0800, Nala Ginrut ]---- > I think there's no such a given function in Guile to do this. > But you can make it in a easy way in Guile: > (catch 'system-error > (lambda () (execlp "asdfasdf")) > (lambda (k . e) > (format #t "oh no~%~"))) > > PS: Maybe you need #f instead of "format" according to your letter. ;-) It's my understanding that the OP does not want to actually run the program but merely knows either the file is in the PATH or not. I guess some-function would be something like : (use-modules (srfi srfi-1)) ; for any (define (in-path? f) (let ((path (string-split (getenv "PATH") #\:)) (make-absolute (lambda (path) (string-append path "/" f)))) (any file-exists? (map make-absolute path))))