I was getting this error about some of the time with things like
exec /bin/ls
and all of the time with ImageMacick stuff like
exec /im/bin/identify -verbose /home/david/test.jpg
I have worked around this problem by defining my own exec proc called dc_exec and in there redirecting the output of program to be executed to a file and then reading the contents back in and returning it.
Unfortunately I've had to go through the all the .tcl files and change exec to dc_exec. Here's the procedure:
# this is a workaround for a problem on FreeBSD where the tcl exec function
# fails half the time with the message
# error reading output from command: interrupted system call
# which as far as I can see is a problem with the output of whatever program
# The workaround is to redirect the output to a file and then read in the file
# and return the output in the normal way
# I have a sequence in the database for unique tmp filenames
#
proc dc_exec {prog_name args} {
# Generate a new unique filename for the output of this command
set db [ns_db gethandle]
set next_id [database_to_tcl_string $db "select nextval('tmp_fname_sequence')"]
ns_db releasehandle $db
set tmpFName [ad_parameter PhotoDataRoot photodb]/dc-exec-$next_id
# Run the command - note the eval here splits the args
set command "exec $prog_name $args > $tmpFName"
eval $command
# Read and return the output of the command - clean up file
set fId [open $tmpFName]
set return_string [read $fId]
close $fId
file delete $tmpFName return $return_string
}