scsh-users
[Top] [All Lists]

Re: How to catch exception raised by ->uid or user-info?

To: scsh-news@zurich.ai.mit.edu
Subject: Re: How to catch exception raised by ->uid or user-info?
From: Andreas Voegele <voegelas@gmx.net>
Date: Sat, 02 Aug 2003 16:41:58 +0200
Andreas Voegele writes:

> How can I catch an exception raised by ->uid or user-info?
>
> The following code always fails (unless the user "foo" exists, of
> course):
>
> (with-errno-handler
>  ((errno packet)
>   (else 0))
>  (->uid "foo"))

I've found out how to catch the exception:

,open handle

(with-handler
 (lambda (condition more)
   0)
 (lambda ()
   (->uid "foo")))

Wouldn't it be better to use errno-error, which hides the Scheme48
exception system, instead of error in uid->user-info and
name->user-info in syscalls.scm?  Would such a change break existing
code, e.g. the code in scsh.scm?

Or is there another way to find out if a user/group exists?

<Prev in Thread] Current Thread [Next in Thread>