Re: system() fails on pristine Windows systems

2005-04-26 Thread Archie Warnock
Brian Dessent wrote: system() is just a wrapper around spawnvp(). If spawn() isn't what you want then neither is system(). spawn() does not necessarily replace the current process (_P_OVERLAY), it can also start and optionally wait for a subprocess (_P_WAIT, _P_NOWAIT, _P_DETACH). Excellent

system() fails on pristine Windows systems

2005-04-25 Thread Archie Warnock
Hi all, I've been through the FAQ and 2 years worth of archives, trying every trick I could find there, but I cannot make this work. I have a program which calls Cygwin's system() function. It works reliably from the Windows command line (outside of Cygwin) on machines that have Cygwin

Re: system() fails on pristine Windows systems

2005-04-25 Thread =?ISO-8859-1?Q?Ren=E9_Berber?=
Archie Warnock wrote: [snip] It seems obvious to me that system() is not finding a command interpreter on the machine, Exactly! although they are correctly listed in the path for the command window. Am I missing something really stupid that needs to be included in the distribution or set

Re: system() fails on pristine Windows systems

2005-04-25 Thread Archie Warnock
René Berber wrote: Yes, you are missing something really simple... have you seen the man page for system()? Of course not, Use `system' to pass a command string `*S' to `/bin/sh'... Hmmm... you're right. Thanks. I was hoping the mention of /bin/sh was more figurative - ie, just _a_

Re: system() fails on pristine Windows systems

2005-04-25 Thread =?ISO-8859-1?Q?Ren=E9_Berber?=
Archie Warnock wrote: [snip] So, what would be the right way to call an external program from a Cygwin program without installing Cygwin, if not system()? I don't know if it works but I would try to use popen(), there's also exec() and all it's relatives. I also find it somewhat puzzling

Re: system() fails on pristine Windows systems

2005-04-25 Thread Brian Dessent
Archie Warnock wrote: Hmmm... you're right. Thanks. I was hoping the mention of /bin/sh was more figurative - ie, just _a_ command interpreter. Guess not, eh? That is how system() works on every unix platform: /bin/sh -c %s So, what would be the right way to call an external program from

Re: system() fails on pristine Windows systems

2005-04-25 Thread Archie Warnock
René Berber wrote: I don't know if it works but I would try to use popen(), there's also exec() and all it's relatives. I'll try popen. I'm not inclined to use anything from exec or spawn - I don't want to replace the program. I just need to run an external program and read the results back

Re: system() fails on pristine Windows systems

2005-04-25 Thread Archie Warnock
Brian Dessent wrote: That is how system() works on every unix platform: /bin/sh -c %s Yep. Got it. You could fork() and exec(), or just call one of the spawn() family of functions. This is all open source you know, you could look and see how system() is implemented in

Re: system() fails on pristine Windows systems

2005-04-25 Thread Archie Warnock
Archie Warnock wrote: The path is irrelevent because it's called as /bin/sh -c cmd, and the location of /bin is taken from the mount table. On your systems without Ummm... are you saying that I have a Cygwin mount table outside of Cygwin? Ahh... I see it now. Thanks for the pointer. --

Re: system() fails on pristine Windows systems

2005-04-25 Thread Brian Dessent
Archie Warnock wrote: You could fork() and exec(), or just call one of the spawn() family of functions. This is all open source you know, you could look and see how system() is implemented in winsup/cygwin/syscalls.cc. I'll have to look and see there. The fork()/exec()/spawn()