* Howto execute a command without the "cmd" windows opening?
@ 2009-11-04 11:15 Matthieu Dubuget
2009-11-04 11:22 ` [Caml-list] " David Allsopp
2009-11-04 12:22 ` Alain Frisch
0 siblings, 2 replies; 8+ messages in thread
From: Matthieu Dubuget @ 2009-11-04 11:15 UTC (permalink / raw)
To: caml-list
Hello,
I'm trying to run a separated program from an ocaml program (linked with
"-subsystem windows" flexlink option). I'm using mingw flavour of Ocaml.
The program to run separately is also an ocaml program, linked with
"-subsystem windows".
The problem is that a "c:\windows\system32\cmd.exe" windows pops up: I'd
like to avoid this.
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 ?
Thanks
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [Caml-list] Howto execute a command without the "cmd" windows opening?
2009-11-04 11:15 Howto execute a command without the "cmd" windows opening? Matthieu Dubuget
@ 2009-11-04 11:22 ` David Allsopp
2009-11-04 11:24 ` Matthieu Dubuget
2009-11-04 12:22 ` Alain Frisch
1 sibling, 1 reply; 8+ messages in thread
From: David Allsopp @ 2009-11-04 11:22 UTC (permalink / raw)
To: matthieu.dubuget, caml-list
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Howto execute a command without the "cmd" windows opening?
2009-11-04 11:22 ` [Caml-list] " David Allsopp
@ 2009-11-04 11:24 ` Matthieu Dubuget
2009-11-04 11:54 ` Matthieu Dubuget
0 siblings, 1 reply; 8+ messages in thread
From: Matthieu Dubuget @ 2009-11-04 11:24 UTC (permalink / raw)
To: David Allsopp; +Cc: caml-list
> 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.
>
>
Thank you David. I'll go this way, then.
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Howto execute a command without the "cmd" windows opening?
2009-11-04 11:24 ` Matthieu Dubuget
@ 2009-11-04 11:54 ` Matthieu Dubuget
2009-11-04 12:04 ` David Allsopp
2009-11-04 12:05 ` Adrien
0 siblings, 2 replies; 8+ messages in thread
From: Matthieu Dubuget @ 2009-11-04 11:54 UTC (permalink / raw)
To: caml-list
>> 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.
>>
>>
>>
> Thank you David. I'll go this way, then.
>
> Matt
>
If i find a way to read the exit status of the process…
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Howto execute a command without the "cmd" windows opening?
2009-11-04 11:15 Howto execute a command without the "cmd" windows opening? Matthieu Dubuget
2009-11-04 11:22 ` [Caml-list] " David Allsopp
@ 2009-11-04 12:22 ` Alain Frisch
2009-11-04 13:58 ` Matthieu Dubuget
1 sibling, 1 reply; 8+ messages in thread
From: Alain Frisch @ 2009-11-04 12:22 UTC (permalink / raw)
To: matthieu.dubuget; +Cc: caml-list
Matthieu Dubuget wrote:
> Is there any way to run a program and get the process status without
> using cmd.exe ?
Did you try Unix.create_process?
Alain
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Howto execute a command without the "cmd" windows opening?
2009-11-04 12:22 ` Alain Frisch
@ 2009-11-04 13:58 ` Matthieu Dubuget
0 siblings, 0 replies; 8+ messages in thread
From: Matthieu Dubuget @ 2009-11-04 13:58 UTC (permalink / raw)
To: Alain Frisch; +Cc: caml-list
-------- Message original --------
Sujet : Re: [Caml-list] Howto execute a command without the "cmd"
windows opening?
De : Alain Frisch <alain@frisch.fr>
Pour : matthieu.dubuget@gmail.com
Date : Wed Nov 04 2009 13:22:01 GMT+0100 (CET)
> Matthieu Dubuget wrote:
>> Is there any way to run a program and get the process status without
>> using cmd.exe ?
>
> Did you try Unix.create_process?
>
> Alain
>
>
Thanks to Alain and David.
Something like
Unix.waitpid []
(Unix.create_process
external_prog args
Unix.stdin Unix.stdout Unix.stderr)
does it.
Salutations
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-11-04 13:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-04 11:15 Howto execute a command without the "cmd" windows opening? Matthieu Dubuget
2009-11-04 11:22 ` [Caml-list] " David Allsopp
2009-11-04 11:24 ` Matthieu Dubuget
2009-11-04 11:54 ` Matthieu Dubuget
2009-11-04 12:04 ` David Allsopp
2009-11-04 12:05 ` Adrien
2009-11-04 12:22 ` Alain Frisch
2009-11-04 13:58 ` Matthieu Dubuget
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox