caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] how to wrap a command line call correctly?
@ 2012-11-21 19:53 Florent Monnier
  2012-11-21 21:19 ` Malcolm Matalka
  2012-11-21 22:41 ` AW: " Gerd Stolpmann
  0 siblings, 2 replies; 3+ messages in thread
From: Florent Monnier @ 2012-11-21 19:53 UTC (permalink / raw)
  To: Caml List

Hi,

I would like to know how to wrap a command line call correctly?

I particular keep the same order of the output messages for stderr and
stdout correctly, how to handle the cases when there is something on
stdin or not, etc.

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] how to wrap a command line call correctly?
  2012-11-21 19:53 [Caml-list] how to wrap a command line call correctly? Florent Monnier
@ 2012-11-21 21:19 ` Malcolm Matalka
  2012-11-21 22:41 ` AW: " Gerd Stolpmann
  1 sibling, 0 replies; 3+ messages in thread
From: Malcolm Matalka @ 2012-11-21 21:19 UTC (permalink / raw)
  To: Florent Monnier; +Cc: Caml List

You can use Jane St Async or Lwt, but your application needs to work
within that context for the best results (although I'm sure you can
do something clever here).  Otherwise you probably need to use the Unix
model or similar and write your own little select loop.  Or use threads
perhaps.

/M

Florent Monnier <monnier.florent@gmail.com> writes:

> Hi,
>
> I would like to know how to wrap a command line call correctly?
>
> I particular keep the same order of the output messages for stderr and
> stdout correctly, how to handle the cases when there is something on
> stdin or not, etc.
>
> Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* AW: [Caml-list] how to wrap a command line call correctly?
  2012-11-21 19:53 [Caml-list] how to wrap a command line call correctly? Florent Monnier
  2012-11-21 21:19 ` Malcolm Matalka
@ 2012-11-21 22:41 ` Gerd Stolpmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Stolpmann @ 2012-11-21 22:41 UTC (permalink / raw)
  To: Florent Monnier; +Cc: Caml List

Am 21.11.2012 20:53:40 schrieb(en) Florent Monnier:
> Hi,
> 
> I would like to know how to wrap a command line call correctly?
> 
> I particular keep the same order of the output messages for stderr and
> stdout correctly, how to handle the cases when there is something on
> stdin or not, etc.

There is no way to keep the order of output messages, except you assign  
stdout and stderr to the same descriptor.

Otherwise, the Shell library included in Ocamlnet is your friend:

http://projects.camlcity.org/projects/dl/ocamlnet-3.6.1/doc/html-main/Shell.html

Especially, it can also be used in a synchronous environment (no need  
to tie yourself to Lwt), but async usage is also possible.

Shell takes advantage of the fast posix_spawn calls so far provided by  
the OS (e.g. on Linux and OS X), which means a significant speed  
advantage compare to fork+exec.

Gerd


> 
> Thanks
> 
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-21 22:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 19:53 [Caml-list] how to wrap a command line call correctly? Florent Monnier
2012-11-21 21:19 ` Malcolm Matalka
2012-11-21 22:41 ` AW: " Gerd Stolpmann

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).