1. RE: system_exec()
- Posted by Al Getz <Xaxo at aol.com> Jul 11, 2003
- 462 views
Juergen Luethje wrote: > > > Hi all, > > I recently noticed, that on my system (Win 98/1st ed., Eu 2.4), after > calling 'system_exec("foo.exe", i)' my interpreted Eu program doesn't > continue with the next statement, but waits, until execution of > 'foo.exe' > is finished. For instance try: > if system_exec("calc", 2) then end if > puts(1, "Hi there.") > if getc(0) then end if > > This behaviour is very useful in certain situations. Unfortunately, I > noticed it, when I had almost finished writing my own routine with this > functionality. > At least on Win 98/1st ed., system() behaves differently. It does *not* > wait for the termination of the called program. > > Is the behaviour of system()/system_exec() the same on all windows > platforms? How about Linux/FreeBSD? I think this should be clearly > documented. > > Best regards, > Juergen > > -- > /"\ ASCII ribbon campain | |\ _,,,---,,_ > \ / against HTML in | /,`.-'`' -. ;-;;,_ > X e-mail and news, | |,4- ) )-,_..;\ ( `'-' > / \ and unneeded MIME | '---''(_/--' `-'\_) > Hi Juergen, I myself only use those functions when there is absolutely no other way of doing something Can you use the win api? Take care, Al
2. RE: system_exec()
- Posted by Al Getz <Xaxo at aol.com> Jul 11, 2003
- 455 views
Juergen Luethje wrote: >Me too. >However, since I came across this issue, I'd like to know, whether or >not system() always calls another program asynchronously, and >system_exc() always does this synchronously. Just because I'd like to >know as much as possible about "my" programming language. >> Can you use the win api? >Yes. As I mentioned, I have almost finished writing a routine, that >seems to be something like a self-written system_exec() function. >It uses the Win Api functions CreateProcess() and >WaitForSingleObject(). >But if system_exec() has the same functionality, why use a self- >written function instead? Hello again, Yes that's a good point. I would use the system_exec function if it did what i wanted it to do also. I had some problems with 'system' at one point. If i remember right, it was only syncronous if you spec the number '2' as second parameter. Havent tried the system_exec function yet, as i just recently upgraded from Euphoria 2.0 to 2.3 (and then 2.4) and 2.0 didnt have it Take care for now, Al
3. RE: system_exec()
- Posted by Al Getz <Xaxo at aol.com> Jul 12, 2003
- 453 views
Juergen Luethje wrote: > > > Hi Jim, you wrote: > > > On Fri, Jul 11, 2003 at 11:49:25PM +0200, Juergen Luethje wrote: > > <big snip> > > >> I'll try to summarize (S: run a child process sychnronously, > >> A: run a child process asychnronously): > Should be "a/synchronously", of course. -------^^^^^^^^^^^^^^ > > >> > >> | Euphoria command > >> | > >> | system() | system_exec() > >> ---------+----------+-------------- > >> DOS | S | S > >> ---------+----------+-------------- > >> Windows | A | S > >> ---------+----------+-------------- > >> Linux | S | S > >> ---------+----------+-------------- > >> FreeBSD | S | S > >> > >> > >> Is this the bottom line? > > > > I thought that system() under Windows would be 'S' not 'A' ... but > > then again I probably wouldn't know... > > I only can say that under Windows 98, 'A' is correct for system(). > I don't think it's likely, that other Windows versions behave different > regarding this point. > Interestingly -- provided this litte table is correct --, the 'A' for > Windows is the exception. The table is almost contrary to what I had > expected. > > Anyway, the question of practical importance for me at the moment was > the behaviour of system_exec() under Windows, and that seems pretty > clear now. > Thanks again to all, who helped me. > > Best regards, > Juergen > > -- > /"\ ASCII ribbon campain | |\ _,,,---,,_ > \ / against HTML in | /,`.-'`' -. ;-;;,_ > X e-mail and news, | |,4- ) )-,_..;\ ( `'-' > / \ and unneeded MIME | '---''(_/--' `-'\_) > Hello again, It looks to me that System() is synchronous. If it werent my EuViewer wouldnt work correctly. When i said it only worked with a '2' as second argument, it was actually a much older version of Euphoria. Apparently, either a 0 or a 2 works ok with the viewer (v2.4 tested). This means it's synchronous. I didnt try '1' because i dont want a beep Take care for now, Al
4. RE: system_exec()
- Posted by Al Getz <Xaxo at aol.com> Jul 13, 2003
- 433 views
Juergen Luethje wrote: > > > Hello again Al, you wrote: > > > Juergen Luethje wrote: > >> > >> > >> Hi Jim, you wrote: > >> > >>> On Fri, Jul 11, 2003 at 11:49:25PM +0200, Juergen Luethje wrote: > >> > >> <big snip> > >> > >>>> I'll try to summarize (S: run a child process sychnronously, > >>>> A: run a child process asychnronously): > >> Should be "a/synchronously", of course. -------^^^^^^^^^^^^^^ > >> > >>>> > >>>> | Euphoria command > >>>> | > >>>> | system() | system_exec() > >>>> ---------+----------+-------------- > >>>> DOS | S | S > >>>> ---------+----------+-------------- > >>>> Windows | A | S > >>>> ---------+----------+-------------- > >>>> Linux | S | S > >>>> ---------+----------+-------------- > >>>> FreeBSD | S | S > >>>> > >>>> > >>>> Is this the bottom line? > >>> > >>> I thought that system() under Windows would be 'S' not 'A' ... but > >>> then again I probably wouldn't know... > >> > >> I only can say that under Windows 98, 'A' is correct for system(). > >> I don't think it's likely, that other Windows versions behave different > >> regarding this point. > >> Interestingly -- provided this litte table is correct --, the 'A' for > >> Windows is the exception. The table is almost contrary to what I had > >> expected. > >> > >> Anyway, the question of practical importance for me at the moment was > >> the behaviour of system_exec() under Windows, and that seems pretty > >> clear now. > >> Thanks again to all, who helped me. > >> > >> Best regards, > >> Juergen > > > > > > Hello again, > > > > It looks to me that System() is synchronous. If it werent > > my EuViewer wouldnt work correctly. > > Hmm... I'd like to have a look at it, but I didn't find anything, when > I searched for "EuViewer" in the RDS archieve. > > > When i said it only worked with a '2' as second argument, > > it was actually a much older version of Euphoria. > > Apparently, either a 0 or a 2 works ok with the viewer (v2.4 tested). > > This means it's synchronous. I didnt try '1' because i dont want > > a beep > > OK, then we'll only use 0 or 2 as second parameter for system(). > > Please try the following code on Windows: > system("calc", 2) > puts(1, "Hi there.") > if getc(0) then end if > > At least on Windows 98, the console window saying "Hi there!" pops up, > although the calculator is still running. > That's why I thought, that on Windows system() is asynchronous. > > Best regards, > Juergen > > -- > /"\ ASCII ribbon campain | |\ _,,,---,,_ > \ / against HTML in | /,`.-'`' -. ;-;;,_ > X e-mail and news, | |,4- ) )-,_..;\ ( `'-' > / \ and unneeded MIME | '---''(_/--' `-'\_) > Hi again Juergen, I see what you mean. Windows programs like that seem to run async, probably because they dont return a value. I'll have to look more at this i guess, but the decompressor i was talking about runs and then returns, and then the program displays the bitmap from the file the decompressor creates. If it didnt happen that way, the program would display the wrong bitmap or cause an error because the file wouldnt be there yet All i can say is that for this kind of .exe it runs synchronously. If you want to check it out, do a search for 'jpg' in the archive. It's not the 'JPG Reader', it's the 'Viewer for .JPG and .BMP'. The viewer calls the .exe program that decompresses the jpg. The 'JPG Reader' is a Euphoria jpg decompressor, and doesnt call any exe programs. Let me know what you find out... Take care for now, Al
5. RE: system_exec()
- Posted by Al Getz <Xaxo at aol.com> Jul 13, 2003
- 468 views
jbrown105 at speedymail.org wrote: > > > On Sun, Jul 13, 2003 at 06:07:17PM +0200, Juergen Luethje wrote: > > > > > > Hello again Al, you wrote: > > > > > Juergen Luethje wrote: > > >> > > >> > > >> Hi Jim, you wrote: > > >> > > >>> On Fri, Jul 11, 2003 at 11:49:25PM +0200, Juergen Luethje wrote: > > >> > > >> <big snip> > > >> > > >>>> I'll try to summarize (S: run a child process sychnronously, > > >>>> A: run a child process asychnronously): > > >> Should be "a/synchronously", of course. -------^^^^^^^^^^^^^^ > > >> > > >>>> > > >>>> | Euphoria command > > >>>> | > > >>>> | system() | system_exec() > > >>>> ---------+----------+-------------- > > >>>> DOS | S | S > > >>>> ---------+----------+-------------- > > >>>> Windows | A | S > > >>>> ---------+----------+-------------- > > >>>> Linux | S | S > > >>>> ---------+----------+-------------- > > >>>> FreeBSD | S | S > > >>>> > > >>>> > > >>>> Is this the bottom line? > > >>> > > >>> I thought that system() under Windows would be 'S' not 'A' ... but > > >>> then again I probably wouldn't know... > > >> > > >> I only can say that under Windows 98, 'A' is correct for system(). > > >> I don't think it's likely, that other Windows versions behave different > > >> regarding this point. > > >> Interestingly -- provided this litte table is correct --, the 'A' for > > >> Windows is the exception. The table is almost contrary to what I had > > >> expected. > > >> > > >> Anyway, the question of practical importance for me at the moment was > > >> the behaviour of system_exec() under Windows, and that seems pretty > > >> clear now. > > >> Thanks again to all, who helped me. > > >> > > >> Best regards, > > >> Juergen > > > > > > > > > Hello again, > > > > > > It looks to me that System() is synchronous. If it werent > > > my EuViewer wouldnt work correctly. > > > > Hmm... I'd like to have a look at it, but I didn't find anything, when > > I searched for "EuViewer" in the RDS archieve. > > > > > > When i said it only worked with a '2' as second argument, > > > it was actually a much older version of Euphoria. > > > Apparently, either a 0 or a 2 works ok with the viewer (v2.4 tested). > > > This means it's synchronous. I didnt try '1' because i dont want > > > a beep > > > > OK, then we'll only use 0 or 2 as second parameter for system(). > > 0, 1, and 2 all have the same effect ... they are all synchronous. > > > > > Please try the following code on Windows: > > system("calc", 2) > > puts(1, "Hi there.") > > if getc(0) then end if > > > > At least on Windows 98, the console window saying "Hi there!" pops up, > > although the calculator is still running. > > That's why I thought, that on Windows system() is asynchronous. > > Thats a special property of Windows GUI programs. Not sure why M$ > choose to do it like that tho. > > Doing system("kcalc &", 2) on a linux/freebsd system via exu would have > system act async as well (since the '&' tells it to run in the > background > instead of the foreground). > > jbrown > > > > > Best regards, > > Juergen > > > > -- > > /"\ ASCII ribbon campain | |\ _,,,---,,_ <snip> Could be they didnt want programs hanging for no good reason. Would be interesting to find out more about this though... Could it be it only waits for programs that return a value? Take care for now, Al