Re: ?? exec prog << value ??



On 31 Mai, 22:16, Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx>
wrote:
On May 31, 9:53 pm, Zeh Mau <chefmue...@xxxxxx> wrote:



set var 4+4\n
puts $var
set result [exec test_prog << $var]
puts $result
-----------------------------------------
4+4

syntax error
can't read "result": no such variable

Very strange. Either test_prog exits with status 0 and result gets set
to something (be it an empty string), or it exits abnormally, and
[exec] raises an exception, hence cannot reach the [puts].

Can you please run strace (I mean "strace tclsh example.tcl") and post
the output ?

-Alex

You are right, the test_prog exits with exit(0),
I also tried return(1).

The error message now is:

syntax error
while executing
"exec test_prog << $var"
invoked from within
"set result [exec test_prog << $var]"
(file "example.tcl" line 5)

.



Relevant Pages