From: Nicolas B. <nic...@ma...> - 2004-08-02 07:22:17
|
Hi again, Here's the complete CgiClose (need to add extensions...) proc CgiExec {script arglist} { global tcl_platform global Cgi switch -- $tcl_platform(platform) { unix { if {[file exists /dev/stdout]} { # This trick "2> /dev/stdout" fails if you start the process in # the background under an xterm, then quit the xterm. In that case # the open raises an error. if { ! [catch {open "|[list $script] $arglist 2> /dev/stdout" r+} pipe]} { return $pipe } } # We use cat to merge the stderr and stdout return [open "|[list $script] $arglist |& cat" r+] } windows { switch -- [file extension $script] { .pl { return [open "|[list $Cgi(perl) $script] $arglist" r+] } .php { return [open "|[list $Cgi(php) $script] $arglist" r+] } .php3 { return [open "|[list $Cgi(php) $script] $arglist" r+] } .phtml { return [open "|[list $Cgi(php) $script] $arglist" r+] } .cgi { return [open "|[list $Cgi(cgiexe) $script] $arglist" r+] } .tcl { return [open "|[list $Cgi(tclsh) $script] $arglist" r+] } .exe { return [open "|[list $script] $arglist" r+] } default { error "Don't know how to execute CGI $script" } } } macintosh { error "CGI not supported on Macintosh" } } } regards, nicolas |