<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body style="background-color: rgb(255, 255, 255); color: rgb(0, 0,
    0);" bgcolor="#FFFFFF" text="#000000">
    Hi Ernesto,<br>
    <br>
    import System.Process (readProcessWithExitCode)<br>
    <br>
    I'm using this for capturing stdout directly:<br>
      (code,output,error) <- readProcessWithExitCode binName (args)
    []<br>
    <br>
    Or when I want to capture the file generated by binName, I set the
    filename to stdout explicitly:<br>
      (code,output,error) <- readProcessWithExitCode binName (args ++
    ["/dev/stdout"]) []<br>
    <br>
    <br>
    Hope it helps,<br>
    <br>
    vlatko<br>
    <br>
    <blockquote style="border-left: 2px solid #330033 !important;
      border-right: 2px solid #330033 !important; padding: 0px 15px 0px
      15px; margin: 8px 2px;"
cite="mid:CAG09Je1fCfKia6d4nE5KWRnbJvB_KDFS0_j7hvPwghUuoHpvzQ@mail.gmail.com"
      type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #330033; border-right: 2px solid #330033;  padding: 0px 15px; margin: 2px 0px;"><![endif]--><span
        style="color:#000000;" class="headerSpan">
        <div class="moz-cite-prefix">-------- Original Message --------<br>
          Subject: [Haskell-cafe] Standard output of exec<br>
          From: Ernesto Rodriguez <a class="moz-txt-link-rfc2396E" href="mailto:neto@netowork.me"><neto@netowork.me></a><br>
          To: Haskell Cafe <a class="moz-txt-link-rfc2396E" href="mailto:haskell-cafe@haskell.org"><haskell-cafe@haskell.org></a><br>
          Date: 11.12.2014 10:11<br>
        </div>
        <br>
        <br>
      </span>
      <div dir="ltr">
        <div>
          <div>Dear All,<br>
            <br>
          </div>
          I have a program which invokes an external program via exec. I
          wish to capture the standard output of the program without
          using external (temporary) files. Is it possible to create an
          in memory handle which I can tell exec to use as standard
          output of the invoked program. It would be great if it can be
          done without any extra dependencies.<br>
          <br>
        </div>
        Best,<br clear="all">
        <div>
          <div>
            <div><br>
              -- <br>
              <div class="gmail_signature">
                <div dir="ltr">
                  <div>Ernesto Rodriguez<br>
                  </div>
                  <div><br>
                  </div>
                  <div>Masters Student</div>
                  <div>Computer Science</div>
                  <div>Utrecht University</div>
                  <div><br>
                  </div>
                  <div><a moz-do-not-send="true"
                      href="http://www.netowork.me" target="_blank">www.netowork.me</a></div>
                  <div><a moz-do-not-send="true"
                      href="http://github.com/netogallo" target="_blank">github.com/netogallo</a></div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Haskell-Cafe mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a>
</pre>
      <!--[if !IE]></DIV><![endif]--></blockquote>
    <br>
  </body>
</html>