caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: jamesj@gmx.com
To: caml-list@yquem.inria.fr
Subject: Creating a pipeline under windows
Date: Tue, 15 Apr 2008 00:07:54 -0400	[thread overview]
Message-ID: <20080415042052.112340@gmx.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1637 bytes --]

                 reply	other threads:[~2008-04-15  4:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080415042052.112340@gmx.com \
    --to=jamesj@gmx.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).