From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA16201; Tue, 13 Nov 2001 03:09:40 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA16648 for ; Tue, 13 Nov 2001 03:09:38 +0100 (MET) Received: from mail.is.titech.ac.jp (mail.is.titech.ac.jp [131.112.51.131]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id fAD29WH14100 for ; Tue, 13 Nov 2001 03:09:33 +0100 (MET) Received: (qmail 27152 invoked from network); 13 Nov 2001 02:09:30 -0000 Received: from mail.is.titech.ac.jp (HELO localhost) (131.112.51.131) by mail.is.titech.ac.jp with SMTP; 13 Nov 2001 02:09:30 -0000 Date: Tue, 13 Nov 2001 11:09:49 +0900 (JST) Message-Id: <20011113.110949.68042772.wakita@is.titech.ac.jp> To: WDuminy@mweb.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Unix and Cgi From: wakita In-Reply-To: <412AC3D29865BA4FB75DBE3DBA869B9D0AB1EB@mwmx3.mweb.com> References: <412AC3D29865BA4FB75DBE3DBA869B9D0AB1EB@mwmx3.mweb.com> X-Mailer: Mew version 2.0.50 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk In message (<412AC3D29865BA4FB75DBE3DBA869B9D0AB1EB@mwmx3.mweb.com>) from "Willem Duminy" , talking about "[Caml-list] Unix and Cgi", on Mon, 12 Nov 2001 08:32:38 +0200 > Hi Guys, > > I am experimenting with ocaml and cgi on Linux/Apache. A handy thing to > have is the ability to execute a shell command and use the result of it > in your cgi program. > So I used open_process_in from the Unix lib to execute the exeternal > command. This all works well when run from the console - but when I run > the same program from cgi - the channel_in contains no information. I > thought it may have to do with the fact that the execution runs in a > spearate thread - maybe cgi does not allow this. > If you have experienced the same problem or have any ideas/hints, please > help. > Regards Unix.channel_in does not require write permission but I presumed that your shell script (i don't know what kind) requires. If the CGI fails due to a runtime error, most probablly you can find an "Uncaught exception" error in the error log of the httpd server. Better approach is trap all the exception in your main routine and show it if an error occurs. The following code fragment may help: let _ = try your_CGI_code () with exc -> Cgi.header ""; printf "Error!%s" (Printexc.to_string exc) Good luck, Ken ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr