You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 889 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
la documentation de create_process dis que :
"All file descriptors of the current process are closed in the new process,
except those redirected to standard input and outputs."
ce qui n'est pas vrai, les deux petits programs suivant le prouve :
-- launcher.ml --
let (pipein, pipeout) = Unix.pipe ();;
if Array.length Sys.argv > 1 then Unix.set_close_on_exec pipeout;;
let pid = Unix.create_process "./prgm" [| "prgm" |]
pipein Unix.stdout Unix.stderr;;
Unix.write pipeout "bliblo" 0 6;;
Unix.close pipein;;
Unix.close pipeout;;
Unix.wait ();;
-- fin de launcher.ml --
-- prgm.ml --
let string = String.create 100;;
while true do
let read = Unix.read Unix.stdin string 0 100 in
if read > 0 then
ignore(Unix.write Unix.stdout string 0 read)
else
exit 0
done
-- fin de prgm --
si on lance launcher sans argument (et donc sans le close_on_exec) l'ensemble
ne s'arrête jamais (prgm attend que toute les sources du pipe soit fermé, or
il en détient une). Alors qu'avec le close_on_exec tout marche bien.
Cordialement
Rémi Vanicat
The text was updated successfully, but these errors were encountered:
Original bug ID: 889
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Vanicat Rémi
Version: OCaml 3.04
OS: debian GNU/linux
Submission from: ca-ol-bordeaux-28-88.abo.wanadoo.fr (80.8.76.88)
Bonjour,
la documentation de create_process dis que :
"All file descriptors of the current process are closed in the new process,
except those redirected to standard input and outputs."
ce qui n'est pas vrai, les deux petits programs suivant le prouve :
-- launcher.ml --
let (pipein, pipeout) = Unix.pipe ();;
if Array.length Sys.argv > 1 then Unix.set_close_on_exec pipeout;;
let pid = Unix.create_process "./prgm" [| "prgm" |]
pipein Unix.stdout Unix.stderr;;
Unix.write pipeout "bliblo" 0 6;;
Unix.close pipein;;
Unix.close pipeout;;
Unix.wait ();;
-- fin de launcher.ml --
-- prgm.ml --
let string = String.create 100;;
while true do
let read = Unix.read Unix.stdin string 0 100 in
if read > 0 then
ignore(Unix.write Unix.stdout string 0 read)
else
exit 0
done
-- fin de prgm --
si on lance launcher sans argument (et donc sans le close_on_exec) l'ensemble
ne s'arrête jamais (prgm attend que toute les sources du pipe soit fermé, or
il en détient une). Alors qu'avec le close_on_exec tout marche bien.
Cordialement
Rémi Vanicat
The text was updated successfully, but these errors were encountered: