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: 1637 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Using create_process_env to call one Caml program from another produces odd
behaviour from the Unix socket calls. See the code samples below.
If test1 is executed, test2 fails because socket() raises an exception, although
it has an error message of "The operation completed successfully".
If test1 is changed to use create_process instead then all works fine.
====test1.ml====
open Unix;;
let envarray = Array.of_list [] in
let argarray = Array.of_list [] in
let prog_path = "{the correct path}\test2.exe" in
let pid = create_process_env prog_path argarray envarray stdin stdout stderr in
ignore(waitpid [] pid);;
====test2.ml=====
open Unix;;
(try ignore(socket PF_INET SOCK_STREAM 6)
with Unix_error(e, s1, s2) -> perr_endline((error_message e)^","^s1^","^s2));
prerr_endline "Socket created OK";;
The text was updated successfully, but these errors were encountered:
Using create_process_env to call one Caml program from another produces odd
behaviour from the Unix socket calls. See the code samples below.
If test1 is executed, test2 fails because socket() raises an
exception, although it has an error message of "The operation
completed successfully".
If test1 is changed to use create_process instead then all works fine.
====test1.ml====
open Unix;;
let envarray = Array.of_list [] in
let argarray = Array.of_list [] in
let prog_path = "{the correct path}\test2.exe" in
let pid = create_process_env prog_path argarray envarray stdin stdout stderr in
ignore(waitpid [] pid);;
This is normal behavior. You're running test2.exe with an empty set
of environment variables. In particular, the PATH environment
variable isn't set, and test2.exe needs it to find the DLLs that it
used, such as the Winsock DLL.
The recommended way to create an environment for use with
Unix.create_process_env is to start with the current environment
as returned by Unix.environment(), and add or carefully remove some
variables from it.
Original bug ID: 1637
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Steve Bishop
Version: 3.06
OS: WinXP SP1
Submission from: thalamus.cl.cam.ac.uk (128.232.8.182)
Using create_process_env to call one Caml program from another produces odd
behaviour from the Unix socket calls. See the code samples below.
If test1 is executed, test2 fails because socket() raises an exception, although
it has an error message of "The operation completed successfully".
If test1 is changed to use create_process instead then all works fine.
====test1.ml====
open Unix;;
let envarray = Array.of_list [] in
let argarray = Array.of_list [] in
let prog_path = "{the correct path}\test2.exe" in
let pid = create_process_env prog_path argarray envarray stdin stdout stderr in
ignore(waitpid [] pid);;
====test2.ml=====
open Unix;;
(try ignore(socket PF_INET SOCK_STREAM 6)
with Unix_error(e, s1, s2) -> perr_endline((error_message e)^","^s1^","^s2));
prerr_endline "Socket created OK";;
The text was updated successfully, but these errors were encountered: