1. system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 11, 2003
- 590 views
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 | '---''(_/--' `-'\_)
2. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 11, 2003
- 582 views
Hi Al, thanks for your reply. > 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. >> > > Hi Juergen, > > I myself only use those functions when there is absolutely no > other way of doing something 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? I am writing a "wrapper" for the Eu2C Translator, so that there is the additional command-line option '-res <resource file>' available. This is simple and straightforward. The program just checks the command-line options, and if '-res <resource file>' is given, this will be extracted from the command line. Then the statement x = system_exec("ecw.exe " & CommandLine, 2) is executed. If '-res <resource file>' was not given on the command-line, this was just an awkward way of calling the translator. If it was given, my program inserts additional lines into the files "emake.bat" and "main_.c". Of course, these files are produced by the translater, and I think my program shouldn't try to change them, before the translater has finised it's work. Best regards, Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)
3. Re: system_exec()
- Posted by Igor Kachan <kinz at peterlink.ru> Jul 11, 2003
- 567 views
Hi Juergen, > 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 system_exec() is function, so it waits the exit code to return it into your program from the child process. > 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. system() is procedure, so it doesn't wait any exit code, but the plane DOS is not multitasking OS and DOS just executes the commands step by step. OS waits. > Is the behaviour of system()/system_exec() the same on all windows > platforms? How about Linux/FreeBSD? I think this should be clearly > documented. Windows, Linux, FreeBSD are all multitasking OSs, so system() doesn't stop your parent program. Just some thoughts, I am not too sure. > Best regards, > Juergen Best regards, Igor Kachan kinz at peterlink.ru
4. Re: system_exec()
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 11, 2003
- 558 views
On Fri, 11 Jul 2003 16:03:27 +0200, Juergen Luethje <j.lue at gmx.de> wrote: >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? I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw (the one that comes with win32lib) for use in MEditor, I think it got rid of an annoying dos window briefly appearing when using system(). AFAIK, system_exec() always waits for the command to complete before returning the exit code from the program. Pete
5. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 11, 2003
- 538 views
Hi Igor, thanks for your reply. <snip> > system_exec() is function, so it waits the exit code > to return it into your program from the child process. Uuuh... *Putting my hands up to my face* Of course. If system_exec() wouldn't wait, then it's return value would be undefined. <snip> > Windows, Linux, FreeBSD are all multitasking OSs, > so system() doesn't stop your parent program. > > Just some thoughts, I am not too sure. This also seems to be quite logical for me now. In contrast to system_exec(), "system() will start a new DOS or Linux/FreeBSD shell." [Eu 2.4 docs] And AFAIK several shells don't wait for each other. > Best regards, > Igor Kachan > kinz at peterlink.ru Thank you, says Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)
6. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 11, 2003
- 579 views
Hi Pete, thanks for your reply. > On Fri, 11 Jul 2003 16:03:27 +0200, Juergen Luethje <j.lue at gmx.de> > wrote: > >> 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? > > I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw > (the one that comes with win32lib) for use in MEditor, As far as I can see, that function calls the ShellExecute() API function (provided by "shell32.dll"). > I think it got > rid of an annoying dos window briefly appearing when using system(). Yes, I think on Windows, ShellExecute() is a good alternative to system(). Thanks for the hint. > AFAIK, system_exec() always waits for the command to complete before > returning the exit code from the program. Now, after having read the replies to my post, I think anything else wouldn't make much sense. Best regards, Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)
7. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 11, 2003
- 533 views
Hello again Al, you wrote: <snip> > 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. This is not what the docs say about the second argument of system(). And regarding a/synchronous execution, I didn't find any explicit description in the docs at all. > 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 Interesting. I didn't know that, since 2.3 was the first Eu version that I learned to know. Best regards, Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)
8. Re: system_exec()
- Posted by jbrown105 at speedymail.org Jul 11, 2003
- 577 views
On Fri, Jul 11, 2003 at 07:15:38PM +0400, Igor Kachan wrote: <snip> > > Is the behaviour of system()/system_exec() the same on all windows > > platforms? How about Linux/FreeBSD? I think this should be clearly > > documented. > > Windows, Linux, FreeBSD are all multitasking OSs, > so system() doesn't stop your parent program. Yes it does. In linux/freebsd, EU system() is a wrapper for C's system(), as is system_exec(). some pseudo code for thought: void eu_system(eu_sequence command, eu_integer wait) { system(make_char_array(command)); ... here would be the ncurses code that figures out what do do with wait } eu_integer eu_system_exec(eu_sequence command, eu_integer wait) { int ret = system(make_char_array(command)); ... here would be the ncurses code that figures out what do do with wait return make_eu_integer(ret); } And, glibc/libc's system(): int system(char* command) { int pid, status; if (command == 0) return 1; pid = fork(); if (pid == -1) return -1; if (pid == 0) { char *argv[4]; argv[0] = "sh"; argv[1] = "-c"; argv[2] = command; argv[3] = 0; execve("/bin/sh", argv, environ); exit(127); } do { if (waitpid(pid, &status, 0) == -1) { if (errno != EINTR) return -1; } else return status; } while(1); } ....in short, system() makes us wait in *nix too. (I did hook into glibc so I could run a child process asychnronously ... but thats not something provided by the language directly. At all.) > > Just some thoughts, I am not too sure. > > > Best regards, > > Juergen > > Best regards, > Igor Kachan > kinz at peterlink.ru > > > > TOPICA - Start your own email discussion group. FREE! > > jbrown -- /"\ ASCII ribbon | http://www.geocities.com/jbrown1050/ \ / campain against | Linux User:190064 X HTML in e-mail and | Linux Machine:84163 /*\ news, and unneeded MIME | http://verify.stanford.edu/evote.html
9. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 11, 2003
- 549 views
Hi Jim, thanks for your reply. > On Fri, Jul 11, 2003 at 07:15:38PM +0400, Igor Kachan wrote: > <snip> >>> Is the behaviour of system()/system_exec() the same on all windows >>> platforms? How about Linux/FreeBSD? I think this should be clearly >>> documented. >> >> Windows, Linux, FreeBSD are all multitasking OSs, >> so system() doesn't stop your parent program. > > Yes it does. > > In linux/freebsd, EU system() is a wrapper for C's system(), as is > system_exec(). > > some pseudo code for thought: > > void eu_system(eu_sequence command, eu_integer wait) > { > system(make_char_array(command)); > ... here would be the ncurses code that figures out what do do with wait > } > > eu_integer eu_system_exec(eu_sequence command, eu_integer wait) > { > int ret = system(make_char_array(command)); > ... here would be the ncurses code that figures out what do do with wait > return make_eu_integer(ret); > } > > And, glibc/libc's system(): > > int system(char* command) > { > int pid, status; > > if (command == 0) > return 1; > pid = fork(); > if (pid == -1) > return -1; > if (pid == 0) { > char *argv[4]; > argv[0] = "sh"; > argv[1] = "-c"; > argv[2] = command; > argv[3] = 0; > execve("/bin/sh", argv, environ); > exit(127); > } > do { > if (waitpid(pid, &status, 0) == -1) { > if (errno != EINTR) > return -1; > } else > return status; > } while(1); > } > > ....in short, system() makes us wait in *nix too. (I did hook into glibc > so I could run a child process asychnronously ... but thats not something > provided by the language directly. At all.) <snip> I'll try to summarize (S: run a child process sychnronously, A: run a child process asychnronously): | Euphoria command | | system() | system_exec() ---------+----------+-------------- DOS | S | S ---------+----------+-------------- Windows | A | S ---------+----------+-------------- Linux | S | S ---------+----------+-------------- FreeBSD | S | S Is this the bottom line? Best regards, Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)
10. Re: system_exec()
- Posted by jbrown105 at speedymail.org Jul 12, 2003
- 571 views
On Fri, Jul 11, 2003 at 11:49:25PM +0200, Juergen Luethje wrote: > > > Hi Jim, thanks for your reply. > > > On Fri, Jul 11, 2003 at 07:15:38PM +0400, Igor Kachan wrote: > > <snip> > >>> Is the behaviour of system()/system_exec() the same on all windows > >>> platforms? How about Linux/FreeBSD? I think this should be clearly > >>> documented. > >> > >> Windows, Linux, FreeBSD are all multitasking OSs, > >> so system() doesn't stop your parent program. > > > > Yes it does. > > > > In linux/freebsd, EU system() is a wrapper for C's system(), as is > > system_exec(). > > > > some pseudo code for thought: > > > > void eu_system(eu_sequence command, eu_integer wait) > > { > > system(make_char_array(command)); > > ... here would be the ncurses code that figures out what do do with wait > > } > > > > eu_integer eu_system_exec(eu_sequence command, eu_integer wait) > > { > > int ret = system(make_char_array(command)); > > ... here would be the ncurses code that figures out what do do with wait > > return make_eu_integer(ret); > > } > > > > And, glibc/libc's system(): > > > > int system(char* command) > > { > > int pid, status; > > > > if (command == 0) > > return 1; > > pid = fork(); > > if (pid == -1) > > return -1; > > if (pid == 0) { > > char *argv[4]; > > argv[0] = "sh"; > > argv[1] = "-c"; > > argv[2] = command; > > argv[3] = 0; > > execve("/bin/sh", argv, environ); > > exit(127); > > } > > do { > > if (waitpid(pid, &status, 0) == -1) { > > if (errno != EINTR) > > return -1; > > } else > > return status; > > } while(1); > > } > > > > ....in short, system() makes us wait in *nix too. (I did hook into glibc > > so I could run a child process asychnronously ... but thats not something > > provided by the language directly. At all.) > > <snip> > > > I'll try to summarize (S: run a child process sychnronously, > A: run a child process asychnronously): > > > | 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... jbrown > > Best regards, > Juergen > > -- > /"\ ASCII ribbon campain | |\ _,,,---,,_ > \ / against HTML in | /,`.-'`' -. ;-;;,_ > X e-mail and news, | |,4- ) )-,_..;\ ( `'-' > / \ and unneeded MIME | '---''(_/--' `-'\_) > > > > TOPICA - Start your own email discussion group. FREE! > > -- /"\ ASCII ribbon | http://www.geocities.com/jbrown1050/ \ / campain against | Linux User:190064 X HTML in e-mail and | Linux Machine:84163 /*\ news, and unneeded MIME | http://verify.stanford.edu/evote.html
11. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 12, 2003
- 547 views
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 | '---''(_/--' `-'\_)
12. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 13, 2003
- 628 views
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 | '---''(_/--' `-'\_)
13. Re: system_exec()
- Posted by jbrown105 at speedymail.org Jul 13, 2003
- 566 views
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 | |\ _,,,---,,_ > \ / against HTML in | /,`.-'`' -. ;-;;,_ > X e-mail and news, | |,4- ) )-,_..;\ ( `'-' > / \ and unneeded MIME | '---''(_/--' `-'\_) > > > > TOPICA - Start your own email discussion group. FREE! > > -- /"\ ASCII ribbon | http://www.geocities.com/jbrown1050/ \ / campain against | Linux User:190064 X HTML in e-mail and | Linux Machine:84163 /*\ news, and unneeded MIME | http://verify.stanford.edu/evote.html
14. Re: system_exec()
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Jul 15, 2003
- 539 views
----- Original Message ----- From: "Pete Lomax" <petelomax at blueyonder.co.uk> > > > On Fri, 11 Jul 2003 16:03:27 +0200, Juergen Luethje <j.lue at gmx.de> > wrote: > > >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? > > I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw > (the one that comes with win32lib) for use in MEditor, I think it got > rid of an annoying dos window briefly appearing when using system(). And in rundemos.exw, I nicked that "jJumpto = define_c_func(lib,"ShellExecuteA"...", (and the "Jump_to" procedure that uses it), from Wolfgang Fritz, who in turn got it from someone known as "DaJaRo". :) Dan Moyer > > AFAIK, system_exec() always waits for the command to complete before > returning the exit code from the program. > > Pete > > > > TOPICA - Start your own email discussion group. FREE! >
15. Re: system_exec()
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 15, 2003
- 538 views
On Mon, 14 Jul 2003 23:27:59 -0700 (07/15/03 16:27:59) , Dan Moyer <DANIELMOYER at prodigy.net> wrote: [snip] >> I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw >> (the one that comes with win32lib) for use in MEditor, I think it got >> rid of an annoying dos window briefly appearing when using system(). > > And in rundemos.exw, I nicked that "jJumpto = > define_c_func(lib,"ShellExecuteA"...", (and the "Jump_to" procedure that > uses it), from Wolfgang Fritz, who in turn got it from someone known as > "DaJaRo". :) > Which is the same as the shellExecuteEx() routine already in win32lib, BTW. -- cheers, Derek Parnell
16. Re: system_exec()
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Jul 15, 2003
- 541 views
----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: system_exec() > > > On Mon, 14 Jul 2003 23:27:59 -0700 (07/15/03 16:27:59) > , Dan Moyer <DANIELMOYER at prodigy.net> wrote: > > [snip] > >> I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw > >> (the one that comes with win32lib) for use in MEditor, I think it got > >> rid of an annoying dos window briefly appearing when using system(). > > > > And in rundemos.exw, I nicked that "jJumpto = > > define_c_func(lib,"ShellExecuteA"...", (and the "Jump_to" procedure that > > uses it), from Wolfgang Fritz, who in turn got it from someone known as > > "DaJaRo". :) > > > > Which is the same as the shellExecuteEx() routine already in win32lib, BTW. > oh...but I *think* it wasn't there when I first began RunDemos? Dan Moyer > -- > > cheers, > Derek Parnell > > > > TOPICA - Start your own email discussion group. FREE! >
17. Re: system_exec()
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 15, 2003
- 574 views
On Mon, 14 Jul 2003 23:59:26 -0700 (07/15/03 16:59:26) , Dan Moyer <DANIELMOYER at prodigy.net> wrote: > > > ----- Original Message ----- > From: "Derek Parnell" <ddparnell at bigpond.com> > To: "EUforum" <EUforum at topica.com> > Subject: Re: system_exec() > > >> On Mon, 14 Jul 2003 23:27:59 -0700 (07/15/03 16:27:59) >> , Dan Moyer <DANIELMOYER at prodigy.net> wrote: >> >> [snip] >> >> I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw >> >> (the one that comes with win32lib) for use in MEditor, I think it got >> >> rid of an annoying dos window briefly appearing when using system(). >> > >> > And in rundemos.exw, I nicked that "jJumpto = >> > define_c_func(lib,"ShellExecuteA"...", (and the "Jump_to" procedure >> that >> > uses it), from Wolfgang Fritz, who in turn got it from someone known >> as >> > "DaJaRo". :) >> > >> >> Which is the same as the shellExecuteEx() routine already in win32lib, > BTW. >> > > oh...but I *think* it wasn't there when I first began RunDemos? > You're correct, but i wanted people to know that they don't have to borrow from RunDemos anymore, unless they want to. -- cheers, Derek Parnell
18. Re: system_exec()
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Jul 16, 2003
- 568 views
----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: system_exec() > > > On Mon, 14 Jul 2003 23:59:26 -0700 (07/15/03 16:59:26) > , Dan Moyer <DANIELMOYER at prodigy.net> wrote: > > > > > ----- Original Message ----- > > From: "Derek Parnell" <ddparnell at bigpond.com> > > To: "EUforum" <EUforum at topica.com> > > Sent: Monday, July 14, 2003 11:37 PM > > Subject: Re: system_exec() > > > > > >> On Mon, 14 Jul 2003 23:27:59 -0700 (07/15/03 16:27:59) > >> , Dan Moyer <DANIELMOYER at prodigy.net> wrote: > >> > >> [snip] > >> >> I've just remembered, I nicked "w32Func(jJumpto" from rundemos.exw > >> >> (the one that comes with win32lib) for use in MEditor, I think it got > >> >> rid of an annoying dos window briefly appearing when using system(). > >> > > >> > And in rundemos.exw, I nicked that "jJumpto = > >> > define_c_func(lib,"ShellExecuteA"...", (and the "Jump_to" procedure > >> that > >> > uses it), from Wolfgang Fritz, who in turn got it from someone known > >> as > >> > "DaJaRo". :) > >> > > >> > >> Which is the same as the shellExecuteEx() routine already in win32lib, > > BTW. > >> > > > > oh...but I *think* it wasn't there when I first began RunDemos? > > > > You're correct, but i wanted people to know that they don't have to borrow > from RunDemos anymore, unless they want to. > Ok doky! :) Dan > -- > > cheers, > Derek Parnell > > > > TOPICA - Start your own email discussion group. FREE! >
19. Re: system_exec()
- Posted by Juergen Luethje <j.lue at gmx.de> Jul 17, 2003
- 558 views
Hi Al, you wrote: > Juergen Luethje wrote: <big snip> >> 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. >> > > 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... I found your program, and looked at it, and I also see what you mean. Unfortunately, ATM I have no explanation for this contradiction(?), too. Best regards, Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)
20. system_exec()
- Posted by Tone Škoda <tskoda at email.si> Mar 28, 2005
- 560 views
- Last edited Mar 29, 2005
i found out that system() and system_exec() dont return until the called program finishes. so what can i use instead that will return immediately? non-win32 specific.
21. Re: system_exec()
- Posted by Greg Haberek <ghaberek at gmail.com> Mar 28, 2005
- 568 views
- Last edited Mar 29, 2005
> i found out that system() and system_exec() dont return until the called > program finishes. so > > what can i use instead that will return immediately? non-win32 specific. http://www.ss64.com/ I found this site the other day, its a list of like *every* shell command on Windows NT/XP, Linux BASH, OS X, and Oracle 8i. At least the useful ones, very handy, especially on Windows. You may be looking for this: http://www.ss64.com/bash/exec.html as in: system( "exec command", 2 ) which should return immediately. :) HTH, ~Greg
22. Re: system_exec()
- Posted by cklester <cklester at yahoo.com> Mar 28, 2005
- 560 views
- Last edited Mar 29, 2005
Tone Škoda wrote: > > i found out that system() and system_exec() dont return until the called > program finishes. > so > > what can i use instead that will return immediately? non-win32 specific. Check this out: http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=6&fromYear=1&toMonth=3&toYear=A&postedBy=&keywords=system+return+immediately -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
23. Re: system_exec()
- Posted by Tone Škoda <tskoda at email.si> Mar 29, 2005
- 551 views
Greg: i don't know what would "command" in system( "exec command", 2 ) be? cklester: thanks for reminding me. so far i didn't find what ive been searching for, only one example of doing it with open_dll() which cant be used in dos. This example: puts (1, "executing\n") system("explorer.exe", 2) system("calc.exe", 2) system("notepad.exe", 2) system("charmap.exe", 2) puts (1, "done\n") opens explorer.exe and calc.exe and then it halts. it looks like it depends on program being executed: explorer.exe returns immediately, calc.exe not (i know because i tried reverse order).
24. Re: system_exec()
- Posted by Greg Haberek <ghaberek at gmail.com> Mar 29, 2005
- 556 views
> Greg: > i don't know what would "command" in system( "exec command", 2 ) be? Sorry.. "command" would be whatever app you want to launch. ~Greg
25. Re: system_exec()
- Posted by Tone Škoda <tskoda at email.si> Mar 29, 2005
- 623 views
- Last edited Mar 30, 2005
Greg Haberek wrote: > > > Greg: > > i don't know what would "command" in system( "exec command", 2 ) be? > > Sorry.. "command" would be whatever app you want to launch. > > ~Greg > > it doesnt work: system("exec C:\\EUPHORIA\\BIN\\EX.EXE", 2) it says: "bad command or file name"
26. Re: system_exec()
- Posted by "Elliott S. de Andrade" <quantum_analyst at hotmail.com> Mar 29, 2005
- 572 views
- Last edited Mar 30, 2005
>From: Tone =8Akoda <guest at RapidEuphoria.com> >Reply-To: EUforum at topica.com >To: EUforum at topica.com >Subject: Re: system_exec() >Date: Tue, 29 Mar 2005 14:36:04 -0800 > >posted by: Tone =8Akoda <tskoda at email.si> > >it doesnt work: >system("exec C:\\EUPHORIA\\BIN\\EX.EXE", 2) >it says: >"bad command or file name" Try system("start calc.exe", 2) > ~[ WingZone ]~ http://wingzone.tripod.com/
27. Re: system_exec()
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Mar 29, 2005
- 548 views
- Last edited Mar 30, 2005
Tone *koda wrote: > > Greg Haberek wrote: > > > > > Greg: > > > i don't know what would "command" in system( "exec command", 2 ) be? > > > > Sorry.. "command" would be whatever app you want to launch. > > > > ~Greg > > > > > it doesnt work: > system("exec C:\\EUPHORIA\\BIN\\EX.EXE", 2) > it says: > "bad command or file name" > AFAIK that's a *nix command. Regards, Alexander Toresson