From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] waitpid should not crash on error Date: Tue, 18 Oct 2011 10:22:34 +0800 Message-ID: References: <87zkgzpn87.fsf@yeeloong.netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf303bfbde74029e04af89658a X-Trace: dough.gmane.org 1318904564 19399 80.91.229.12 (18 Oct 2011 02:22:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 18 Oct 2011 02:22:44 +0000 (UTC) To: Mark H Weaver , guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Oct 18 04:22:40 2011 Return-path: Envelope-to: guile-devel@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 1RFzKC-0003CM-OD for guile-devel@m.gmane.org; Tue, 18 Oct 2011 04:22:40 +0200 Original-Received: from localhost ([::1]:41448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFzKB-0006L5-VD for guile-devel@m.gmane.org; Mon, 17 Oct 2011 22:22:39 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFzK9-0006Kj-2S for guile-devel@gnu.org; Mon, 17 Oct 2011 22:22:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFzK7-0003vE-MU for guile-devel@gnu.org; Mon, 17 Oct 2011 22:22:36 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:63588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFzK7-0003uy-JD for guile-devel@gnu.org; Mon, 17 Oct 2011 22:22:35 -0400 Original-Received: by iagf6 with SMTP id f6so162697iag.0 for ; Mon, 17 Oct 2011 19:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=44W15QU4vEtOEaMXWUMrX97dQQSj6tREkyhNUu8ZvdA=; b=PihGIMqUz8bfoO7BMl/C7ixKB0T+W5M0bzH9AKC1rTeonQ4DaUC2TgtIaoJBk3axZN ypoztgOjPSvZ8p47aeKkFkojqRrIutZudoifDLTvc51UY3A/yb6cJFPS7PLOWHAbny7W HFffb+v2L9HbCOrVchjQTwfgbkCDvcX5px7TU= Original-Received: by 10.42.197.197 with SMTP id el5mr741698icb.23.1318904554324; Mon, 17 Oct 2011 19:22:34 -0700 (PDT) Original-Received: by 10.43.132.133 with HTTP; Mon, 17 Oct 2011 19:22:34 -0700 (PDT) In-Reply-To: <87zkgzpn87.fsf@yeeloong.netris.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12842 Archived-At: --20cf303bfbde74029e04af89658a Content-Type: text/plain; charset=UTF-8 On Tue, Oct 18, 2011 at 1:00 AM, Mark H Weaver wrote: > Nala Ginrut writes: > > I realized that "waitpid" in Guile will cause my program crash while > > "waitpid" actually returned -1. I believe it's unnecessary. I think > > the better way is we deal with it by ourselves if "waitpid in POSIX" > > returned -1. The SCM_SYSERROR bother me a lot. I hope my program > > get robustness other than crash. > > The proper way to deal with this is to catch the system error, e.g.: > > (catch 'system-error > (lambda () (waitpid the-pid)) > (lambda (key . args) 'waitpid-failed)) > > Best, > Mark > Oh thanks ,that's what I need. But how can I find the error message like 'waitpid-failed? I can't find it in the manual. --20cf303bfbde74029e04af89658a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Oct 18, 2011 at 1:00 AM, Mark H Weaver <= span dir=3D"ltr"><mhw@netris.org&g= t; wrote:
Nala Ginrut <n= alaginrut@gmail.com> writes:
> I realized that "waitpid" in Guile will cause my program cra= sh while
> "waitpid"=C2=A0actually=C2=A0returned -1. I believe it's= =C2=A0unnecessary. I think
> the better way is we deal with it by ourselves if "waitpid in POS= IX"
> returned -1. The SCM_SYSERROR bother me a lot. I hope my program
> get=C2=A0robustness other than crash.=C2=A0

The proper way to deal with this is to catch the system error, e.g.:<= br>
(catch 'system-error
=C2=A0(lambda () (waitpid the-pid))
=C2=A0(lambda (key . args) 'waitpid-failed))

=C2=A0 =C2=A0 Best,
=C2=A0 =C2=A0 =C2=A0Mark

Oh thanks ,that's what I need.
=
But how can I find the error message like 'waitpid-failed? I can&#= 39;t find it in the manual.=C2=A0
--20cf303bfbde74029e04af89658a--