Re: system/system_exec problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 ]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu