Re: system/system_exec problem
- Posted by "Carl W." <euphoria at cyreksoft.yorks.com> Jun 17, 2003
- 509 views
Igor Kachan & Irv Mullins wrote: >>-- Program 2 >>#!/home/irv/euphoria/bin/exu >>object x >>x = system_exec("ls > DIRECTORY",0) >> >>This works, if it's run from the command line >> or from an xterm, but HANGS if run it by clicking >>on the program's icon. > > Doc says "system_exec() doesn't allow the use of command-line > redirection in the command string st". A bit more long-winded, but this technique might work (untested): #!/home/path/exu object x -- create a temporary script to do the redirection x = open("tempscript", "w") puts(x, "ls > DIRECTORY" & "\n" & -- command we wish to execute "exit $?" & "\n" -- return the error status ) close(x) -- make it executable system("chmod 700 tempscript",2) -- run it; tempscript returns status into x x = system_exec("tempscript", 0) -- tidy up system("rm -f tempscript") Carl -- [ Carl R White == aka () = The Domain of Cyrek = ] [ Cyrek the Illogical /\ www.cyreksoft.yorks.com ]