unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: rixed@happyleptic.org
To: guile-user@gnu.org
Subject: Re: execlp
Date: Wed, 23 Nov 2011 15:03:31 +0100	[thread overview]
Message-ID: <20111123140331.GB3674@ccellier.rd.securactive.lan> (raw)
In-Reply-To: <CAPjoZodBcRnqsHik4XWeWCxnOgZzeyHaS1VAGoiW7JXZjTbTwQ@mail.gmail.com>

-[ 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	other threads:[~2011-11-23 14:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 16:06 execlp Paul Emsley
2011-11-23  5:47 ` execlp Nala Ginrut
2011-11-23  5:57   ` execlp Nala Ginrut
2011-11-23 12:16   ` execlp Paul Emsley
2011-11-23 12:22     ` execlp Nala Ginrut
2011-11-23 12:28     ` execlp Nala Ginrut
2011-11-23 14:03       ` rixed [this message]
2011-11-23 14:38         ` execlp Nala Ginrut
2011-11-23 19:18     ` execlp Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111123140331.GB3674@ccellier.rd.securactive.lan \
    --to=rixed@happyleptic.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).