From b4eaba71c66f19e32ac2ff47169a01d62b2a229b Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Mon, 20 Jul 1998 16:20:46 +0000 Subject: [PATCH] [project @ 1998-07-20 16:20:46 by sof] - Added a word of warning on using 'executeFile' *and* have parent and child share open files. --- ghc/docs/users_guide/posix.vsgml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ghc/docs/users_guide/posix.vsgml b/ghc/docs/users_guide/posix.vsgml index 9896fd1613e8..3df9af8c83dd 100644 --- a/ghc/docs/users_guide/posix.vsgml +++ b/ghc/docs/users_guide/posix.vsgml @@ -291,8 +291,19 @@ be written by hand. Care must be taken to ensure that the search path is extracted from the original environment, and not from the environment to be passed on to the new image. +NOTE: In general, sharing open files between parent and child +processes is potential bug farm, and should be avoided unless you +really depend on this `feature' of POSIX' @fork()@ semantics. Using +Haskell, there's the extra complication that arguments to +@executeFile@ might come from files that are read lazily (using +@hGetContents@, or some such.) If this is the case, then for your own +sanity, please ensure that the arguments to @executeFile@ have been +fully evaluated before calling @forkProcess@ (followed by +@executeFile@.) Consider yourself warned :-) + A successful @executeFile@ overlays the current process image with a new one, so it only returns on failure. + <tscreen><verb> runProcess :: FilePath -- Command -> [String] -- Arguments -- GitLab