caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: wakita <wakita@is.titech.ac.jp>
To: WDuminy@mweb.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Unix and Cgi
Date: Tue, 13 Nov 2001 11:09:49 +0900 (JST)	[thread overview]
Message-ID: <20011113.110949.68042772.wakita@is.titech.ac.jp> (raw)
In-Reply-To: <412AC3D29865BA4FB75DBE3DBA869B9D0AB1EB@mwmx3.mweb.com>


In message (<412AC3D29865BA4FB75DBE3DBA869B9D0AB1EB@mwmx3.mweb.com>)
from "Willem Duminy" <WDuminy@mweb.com>,
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 "<html><title>Error!</title><body>%s</body></html>"
      (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


      reply	other threads:[~2001-11-13  2:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-12  6:32 Willem Duminy
2001-11-13  2:09 ` wakita [this message]

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

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

  git send-email \
    --in-reply-to=20011113.110949.68042772.wakita@is.titech.ac.jp \
    --to=wakita@is.titech.ac.jp \
    --cc=WDuminy@mweb.com \
    --cc=caml-list@inria.fr \
    /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 NNTP newsgroup(s).