English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Howto execute a command without the "cmd" windows opening?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-11-04 (11:22)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] Howto execute a command without the "cmd" windows opening?
> The problem is that a "c:\windows\system32\cmd.exe" windows pops up:
> I'd like to avoid this.

Both Sys.command and Unix.system use cmd in order to provide command line
parsing (it gives the closest equivalent to the Unix version - except for
the usual quoting weirdness of cmd as compared to bash!)

> I tried Sys.command and Unix.system without success.
> Is there any way to run a program and get the process status without
> using cmd.exe ?

It's been on my todo list to wrap the CreateProcess Win32 API function[1] in
a C stub function - someone else may have done this (possibly in
ocaml-win32[2] or something like that), though. The API is very simple (most
parameters will be NULL) so the stub would not take long to write.


[1] http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx
[2] http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=371