From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: caml-list@inria.fr
Subject: restart any OCaml program from scratch:
Date: Thu, 11 Jan 2001 22:31:29 -0500 [thread overview]
Message-ID: <3A5E7A91.AC8FC7EF@univ-savoie.fr> (raw)
I post the following lines taht may be useful to others:
they provide a small command restart : unit -> unit which will restart
your program
from scratch.
To use it just link you program with restart.cmo at first position.
I have some questions for Unix and Windows specialist:
- using "exit 3" is may be not the cleanest way ?
- will this trick or a similar one work under windows ?
- what should I do when the process status is WSIGNALED n (at the
moment
I do exit 1)
----- restart.mli ----------
val restart : unit -> 'a
----- restart.ml ----------
open Unix
let restart () = exit 3
let _ =
try
while true do
let pid = fork () in
if pid = 0 then raise Exit else
match waitpid [] pid with
_, WEXITED 3 -> ()
| _, WEXITED n -> exit n
| _, _ -> exit 1
done
with Exit -> ()
--
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex
tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
reply other threads:[~2001-01-12 9:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3A5E7A91.AC8FC7EF@univ-savoie.fr \
--to=christophe.raffalli@univ-savoie.fr \
--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