From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=AWL,HTML_MESSAGE,NO_REAL_NAME autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 78F21BBCA for ; Tue, 15 Apr 2008 06:20:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao4KAEfKA0hK0AVDZGdsb2JhbACCQzMpiBGFKGwaBAoGmgI X-IronPort-AV: E=Sophos;i="4.25,658,1199660400"; d="scan'208,217";a="9583280" Received: from mail.gmx.com ([74.208.5.67]) by mail2-smtp-roc.national.inria.fr with SMTP; 15 Apr 2008 06:20:54 +0200 Received: (qmail 25475 invoked by uid 0); 15 Apr 2008 04:20:53 -0000 Received: from 67.177.185.135 by www-us008.gmx.net with HTTP; Tue, 15 Apr 2008 00:20:52 -0400 (EDT) Content-Type: multipart/alternative; boundary="========GMXBoundary112341208233252904785" Date: Tue, 15 Apr 2008 00:07:54 -0400 From: jamesj@gmx.com Message-ID: <20080415042052.112340@gmx.com> MIME-Version: 1.0 subject: Creating a pipeline under windows To: caml-list@yquem.inria.fr X-Authenticated: #46952340 X-Flags: 0001 X-Mailer: WWW-Mail 6107 (Global Mail Exchange) X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1+yCQZWU4KyrZrInhdXNNV4BLlhzIk/XO24TYPnAE Llnq1MM1yCI8ZNWYc9CFJbMXku2CizrFX32g== X-Registered: 0 X-GMX-UID: alhlLItKzVK0LPUAuTMzV4A/Njh6dA7V X-Spam: no; 0.00; simulate:01 stdout:01 stderr:01 stdin:01 stderr:01 waitpid:01 waitpid:01 simulate:01 stdout:01 stdin:01 height:98 border-left:98 ccc:98 padding-left:98 unix:01 X-Attachments: cset="utf-8" --========GMXBoundary112341208233252904785 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit I am trying to write a cross-platform program that will simulate the effect of the following shell command:   prog1 | prog2 i.e. create a pipeline. The following code let () =   let r,w = Unix.pipe () in   Unix.set_close_on_exec w;   let w_pid = Unix.create_process "prog2" [|"prog2"|] r Unix.stdout Unix.stderr in   Unix.close r;   let r_pid = Unix.create_process "prog1" [|"prog1"|] Unix.stdin w Unix.stderr in   Unix.close w;   assert (snd (Unix.waitpid [] w_pid) = Unix.WEXITED 0 &&           snd (Unix.waitpid [] r_pid) = Unix.WEXITED 0) works fine on linux but not on windows (using the native port). I tried to comment out the Unix.set_close_on_exec and/or the Unix.close lines but it does not help. I was not successful with the Unix.open_process_* functions either. --========GMXBoundary112341208233252904785 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable I am trying to write a cross-platform program that will simulate the effect= of the following shell command:

  prog1 | prog2

i.e. cr= eate a pipeline. The following code

let () =3D
  let r,w =3D= Unix.pipe () in
  Unix.set_close_on_exec w;
  let w_pid = =3D Unix.create_process "prog2" [|"prog2"|] r Unix.stdout Unix.stderr in  Unix.close r;
  let r_pid =3D Unix.create_process "prog1" [= |"prog1"|] Unix.stdin w Unix.stderr in
  Unix.close w;
  as= sert (snd (Unix.waitpid [] w_pid) =3D Unix.WEXITED 0 &&
 &n= bsp;        snd (Unix.waitpid [] r_pid) = =3D Unix.WEXITED 0)

works fine on linux but not on windows (using th= e native port). I tried to comment out the Unix.set_close_on_exec and/or th= e Unix.close lines but it does not help. I was not successful with the Unix= .open_process_* functions either.
--========GMXBoundary112341208233252904785--