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

Posted by Gustaf Neumann on
The hint with the CHILDSTATUS rings a bell. In case Neo's suggestion does not help, one more idea for debugging. Write a wrapper (e.g. named /tmp/ like the following
echo xxx `/usr/bin/id`
/usr/bin/libreoffice --headless --convert-to xls SOMEFILE.csv --outdir /tmp
echo "xxx $? exit code"
fill in a .csv tile for testing and call the wrapper via
set result [exec bash /tmp/]
i would not be wondering, when you get on your machine now a useful result now, showing a non-zero exit code from libreoffice. Maybe there is a permission problem under the userid of the server? Handing CHILDSTATUS in Tcl requires some special, which i don't see in nsproxy. Probably nsproxy has to be improved to return better errors.
Posted by Gustaf Neumann on
I've compared the cases, where tcl-exec and/or nsproxy-exec calls a program with a non-zero return status. In both cases, the behavior is the same, one gets the return status via the global variable ::errorCode. The following snippet shows the result code from the called program:
set cmd {/usr/bin/libreoffice ... --outdir /tmp}
if {[catch {set result [exec {*}$cmd]} errorMsg]} {
   lassign {*}$::errorCode code id value
   if {$code eq "CHILDSTATUS"} {set result "program exited with code $value"}
so, the nsproxy behavior is technically correct, just the error message from tcl could be better. What return code do you get in your installation?
Posted by Benjamin Brink on
Gustaf writes:

"Maybe there is a permission problem under the userid of the server."

I've had this happen before.

Antonio, what happens if you use a different directory using server's owner and group same as openacs system, such as a openacs-4/tmp/ ?