Forum OpenACS Q&A: Re: Can't exec a command in tcl page

Collapse
Posted by Benjamin Brink on
Examine the server log. Does the error message provide more detail?
Collapse
Posted by Antonio Pisano on
This is what the log says... nothing new...

child process exited abnormally
while executing
"exec libreoffice --headless --convert-to xls /tmp/filedNva4p.xls /tmp/filedNva4p"
invoked from within
"ns_proxy eval $handle "exec $call""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"with_finally -code {
set return_string [ns_proxy eval $handle "exec $call"]
} -finally {
ns_proxy release $handle
}"
(procedure "proxy::exec" line 4)
invoked from within
"proxy::exec -call $args"
(procedure "exec" line 1)
invoked from within
"exec libreoffice --headless --convert-to xls ${tmpfile}.xls $tmpfile"
("uplevel" body line 212)
invoked from within...

Calling the very same exec command in tclsh by the command line (on the same server) works as expected.

Collapse
Posted by Antonio Pisano on
The real command is this, took the wrong part of the log.

exec libreoffice --headless --convert-to xls /tmp/fileBXXCcF.xls /tmp/fileBXXCcF.csv

Same error though.

Collapse
Posted by Dave Bauer on
Does the operation complete successfully?

We had this problem with many commands, where the output of the command causes Tcl exec to think the command has failed when it was fine.

We catch the exec and look for specific error responses in the output as necessary.

Many sites I have worked on used a modified exec replacement that took care of the catch automatically.

Collapse
Posted by Gustaf Neumann on
A common cause is that the executed script outputs to stderr. This leads per-default to the same failure like a non-zero return code. I would recommend to redirect stderr to stdout (adding the the script 2>@1)

A longer discussion is e.g. here: http://wiki.tcl.tk/1039