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

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?