diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2017-03-14 15:34:51 +0100 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2017-03-26 19:41:02 +0200 |
commit | 3f614747886a7f25b9db91fc35bc76d57a5efa8e (patch) | |
tree | ec838daadffdd129c11ea1bd67f60b170e486b25 /testsuite/tests | |
parent | 8c117682748b374a5c50162eb463f10e4236428d (diff) | |
download | ocaml-3f614747886a7f25b9db91fc35bc76d57a5efa8e.tar.gz |
Fix Unix.create_process in the case where the same descriptor is used several times (continued)
The lightweight fix in commit c32773d wasn't good enough if the repeated descriptor is 0, 1 or 2, e.g. Unix.create_process ... Unix.stdin Unix.stdout Unix.stdout.
By lack of better ideas, this commit reverts to the 4.04 implementation of perform_redirections.
The test suite was updated with the Unix.create_process ... Unix.stdin Unix.stdout Unix.stdout case above.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/lib-unix/redirections.ml | 10 | ||||
-rw-r--r-- | testsuite/tests/lib-unix/redirections.reference | 1 |
2 files changed, 2 insertions, 9 deletions
diff --git a/testsuite/tests/lib-unix/redirections.ml b/testsuite/tests/lib-unix/redirections.ml index 0956344b1c..7f0ed8aed6 100644 --- a/testsuite/tests/lib-unix/redirections.ml +++ b/testsuite/tests/lib-unix/redirections.ml @@ -40,20 +40,14 @@ let test_createprocess () = Sys.remove "./tmperr.txt" let test_2ampsup1 () = (* 2>&1 redirection, cf. GPR#1105 *) - let f = - Unix.(openfile "./tmpout.txt" [O_WRONLY;O_TRUNC;O_CREAT;O_CLOEXEC] 0o600) in let pid = Unix.create_process refl [| refl; "o"; "123"; "e"; "456"; "o"; "789" |] - Unix.stdin f f in + Unix.stdin Unix.stdout Unix.stdout in let (_, status) = Unix.waitpid [] pid in - Unix.close f; if status <> Unix.WEXITED 0 then - out Unix.stdout "!!! reflector exited with an error\n"; - out Unix.stdout "---- File tmpout.txt\n"; - cat "./tmpout.txt"; - Sys.remove "./tmpout.txt" + out Unix.stdout "!!! reflector exited with an error\n" let test_open_process_in () = let ic = Unix.open_process_in (refl ^ " o 123 o 456") in diff --git a/testsuite/tests/lib-unix/redirections.reference b/testsuite/tests/lib-unix/redirections.reference index b958e756cb..12d1588473 100644 --- a/testsuite/tests/lib-unix/redirections.reference +++ b/testsuite/tests/lib-unix/redirections.reference @@ -8,7 +8,6 @@ xvar bbbb 456 ** create_process 2>&1 redirection ----- File tmpout.txt 123 456 789 |