Re: system_exec fun :(
- Posted by jbrown1050 at hotpop.com Jan 30, 2003
- 427 views
On Sun, Apr 22, 2001 at 03:11:17AM +0200, Alan Oxley wrote: > > Gents and Ladies, > After many hours of puzzlement, code butchering and fighting with > delimiters, > I discovered that you cannot call a program directly via system_exec if the > program name is not the msdos 8.3 format. While the difficulties with the > "C:\\progra~1\\" etc are mentioned in the mailing list, the program name > restriction does not appear to be. > example: system_exec("PatrolCli",2) -- fails with -1, no other info > while system_exec("PATROL~1",2) -- works ok. Its not suprising, unless your calling system_exec() from exw.exe (ex.exe being a dos program, can't see long filenames at all.) > What took so long, was the fact that if you type the "PatrolCli" yourself, > it works! > > The workaround is to do a dos "dir /X" and trap the output - this shows both > the > long and shortened name. Grab the short version and away you go. try Juergen's lfn.e, it can give you long filename support (it has a function, you can use it to file the short filename of a file, given its long filename, iirc that is). > > Also, system_exec is a function that returns -1 if the command failed. > You can't redirect output, so you are in the dark as to the failure. > Anybody know a sane way of discovering the problem when you get -1 ?. Its probably a "Command not found" type of thing ... odds are good that its looking for a command named "patrolcl" but not finding it, in this case. > Tried system() but I get invalid command; I have a convoluted argument > that is not acceptible to system(). Over 100 chars long in fact. > I've fixed it now, but what about next time? Could you be more specific about this? > > Finally, you can't stack win2k (dos) commands with an ampersand - > you get "invalid continuation" from Euphoria. Huh? Show us the line where you use the '&' w/ the commands. > > IMHO some better feedback from system_exec would be very welcome! > > HTH other strugglers with system_exec. > > Cheers > Alan > jbrown > > > TOPICA - Start your own email discussion group. FREE! -- /"\ ASCII ribbon | \ / campain against | Linux User:190064 X HTML in e-mail and | Linux Machine:84163 /*\ news, and unneeded MIME |