Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_process ne fais pas ce que la doc dit #3204

Closed
vicuna opened this issue Feb 13, 2002 · 1 comment
Closed

create_process ne fais pas ce que la doc dit #3204

vicuna opened this issue Feb 13, 2002 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 13, 2002

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

@vicuna
Copy link
Author

vicuna commented Mar 11, 2002

Comment author: administrator

Fixed documentation 2002-03-11, XL.

@vicuna vicuna closed this as completed Mar 11, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant