Index: openacs-4/packages/xotcl-core/www/show-class-graph.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/www/show-class-graph.tcl,v diff -u -r1.12.2.4 -r1.12.2.5 --- openacs-4/packages/xotcl-core/www/show-class-graph.tcl 2 Aug 2021 21:16:33 -0000 1.12.2.4 +++ openacs-4/packages/xotcl-core/www/show-class-graph.tcl 29 Nov 2021 13:20:11 -0000 1.12.2.5 @@ -15,24 +15,30 @@ set dot_code [::xo::dotcode -dpi $dpi \ -with_children $with_children -documented_methods $documented_only \ $classes] -set dot "" -catch {set dot [::util::which dot]} -# final resort for cases, where ::util::which is not available -if {$dot eq "" && [file executable /usr/bin/dot]} {set dot /usr/bin/dot} -if {$dot eq ""} {ns_return 404 plain/text "dot not found"; ad_script_abort} +set dot [::util::which dot] -set tmpnam [ad_tmpnam] -set tmpfile $tmpnam.$format +if {$dot eq ""} { + ns_return 404 plain/text "dot not found" + ad_script_abort +} -#ns_log notice "png $tmpnam dot $tmpnam.dot" -set f [open "|$dot -T$format -o $tmpfile" w]; puts $f $dot_code; close $f -ns_returnfile 200 [ns_guesstype $tmpfile] $tmpfile -file delete -- $tmpfile +set stem [ad_tmpnam] +set dotfile $stem.dot +set outfile $stem.$format -#set f [open $tmpnam.dot w]; puts $f $dot_code; close $f -#file delete -- $tmpnam.dot +try { + set f [open $dotfile w]; puts $f $dot_code; close $f + exec $dot -T$format -o $outfile $dotfile +} on error {errorMsg} { + ns_log warning "show-class-graph: dot returned $errorMsg" + ad_return_error "dot error" $errorMsg +} on ok {result} { + ns_returnfile 200 [ns_guesstype $outfile] $outfile + file delete -- $outfile +} finally { + file delete -- $dotfile +} - # # Local variables: # mode: tcl