unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Nala Ginrut <nalaginrut@gmail.com>
To: rixed@happyleptic.org, guile-user@gnu.org,
	 Paul Emsley <paul.emsley@bioch.ox.ac.uk>
Subject: Re: execlp
Date: Wed, 23 Nov 2011 22:38:09 +0800	[thread overview]
Message-ID: <CAPjoZod7RZo-gmDDJz7mZQGqEPRLi_HHRSXh81huzFcA89bgcw@mail.gmail.com> (raw)
In-Reply-To: <20111123140331.GB3674@ccellier.rd.securactive.lan>

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

On Wed, Nov 23, 2011 at 10:03 PM, <rixed@happyleptic.org> wrote:

> -[ 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))))
>
>
>
Well, I realized that Paul want this some-function to detect whether file
can be executed.
[quote] My question is then, *is* there a way to determine if a string is
executable? (And if so, how? :-) .[/quote]
I confess that I didn't quite understand this question.
So I guess there're two alternatives:
1. He needs some-function to detect each file in a path an return the
result or #f;
2. He needs some-function to handle the error if a certain string can not
be executed.

[-- Attachment #2: Type: text/html, Size: 2632 bytes --]

  reply	other threads:[~2011-11-23 14:38 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       ` execlp rixed
2011-11-23 14:38         ` Nala Ginrut [this message]
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=CAPjoZod7RZo-gmDDJz7mZQGqEPRLi_HHRSXh81huzFcA89bgcw@mail.gmail.com \
    --to=nalaginrut@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=paul.emsley@bioch.ox.ac.uk \
    --cc=rixed@happyleptic.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).