From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 65A77BBAF for ; Wed, 4 Nov 2009 12:22:47 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmgBAKby8EpRZ90xkWdsb2JhbACbVwEBAQEJCwoHEwPBJYQ9BIFl X-IronPort-AV: E=Sophos;i="4.44,679,1249250400"; d="scan'208";a="39503008" Received: from mtaout03-winn.ispmail.ntl.com ([81.103.221.49]) by mail1-smtp-roc.national.inria.fr with ESMTP; 04 Nov 2009 12:22:47 +0100 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20091104112246.PPPO17277.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Wed, 4 Nov 2009 11:22:46 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20091104112246.MBKV22934.aamtaout04-winn.ispmail.ntl.com@romulus.metastack.com>; Wed, 4 Nov 2009 11:22:46 +0000 Received: from COUNTERTENOR ([172.16.0.158]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id nA4BMght008983 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 4 Nov 2009 11:22:43 GMT From: "David Allsopp" To: , References: <4AF16258.6010508@gmail.com> In-Reply-To: <4AF16258.6010508@gmail.com> Subject: RE: [Caml-list] Howto execute a command without the "cmd" windows opening? Date: Wed, 4 Nov 2009 11:22:41 -0000 Message-ID: <021001ca5d41$20175d60$60461820$@allsopp@metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcpdQCyJtyCkO/C5TUGw0EgMmN2vUwAAEkFA Content-Language: en-gb Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.0 c=1 a=VooCfk1-DGMA:10 a=yMhMjlubAAAA:8 a=ZOzjf2MOAAAA:8 a=L99NpuPrJESbMWQsofwA:9 a=mv2dI3Lt0Z_2PMAGRO32AIAje1oA:4 X-Spam: no; 0.00; howto:01 stub:01 ocaml-win:01 stub:01 contrib:01 unix:01 unix:01 parsing:01 caml-list:01 caml:02 quoting:02 api:02 api:02 hump:02 sys:03 > 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. David [1] http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx [2] http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=371