guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: execlp


From: rixed
Subject: Re: execlp
Date: Wed, 23 Nov 2011 15:03:31 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

-[ 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))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]