proxy::exec (public)

 proxy::exec -call call [ -cd cd ] [ -ignorestderr ]

Defined in packages/acs-tcl/tcl/proxy-procs.tcl

Execute the statement in a proxy instead of normal exec

Switches:
-call
(required)
Call which is passed to the "exec" command
-cd
(optional)
Change to the given directory before executing the command
-ignorestderr
(boolean) (optional)
Boolean value to indicate, whether the stderr output of the exec'ed command should be ignored.

Partial Call Graph (max 5 caller/called nodes):
%3 db_source_sql_file db_source_sql_file (public) proxy::exec proxy::exec db_source_sql_file->proxy::exec exec exec (public) exec->proxy::exec ad_try ad_try (public) proxy::exec->ad_try

Testcases:
No testcase defined.
Source code:
        set start_time [clock clicks -milliseconds]
        set handle [ns_proxy get ExecPool]
        if {[clock clicks -milliseconds] - $start_time > 5} {
            ns_log warning "ExecPool: getting handle took  [expr {[clock clicks -milliseconds] - $start_time}]ms (potential configuration issue)"
        }

        # Check that encoding in the proxied interpreter is the same
        # as in the main interpreter. If not, we set it the same and
        # reset it after command execution.
        set proxy_encoding [ns_proxy eval $handle [list encoding system]]
        if {$proxy_encoding eq [encoding system]} {
            set reset_encoding_p 0
        } else {
            ns_proxy eval $handle [list encoding system [encoding system]]
            set reset_encoding_p 1
        }

        ad_try {
            if {[info exists cd]} {
                #
                # We were requested to switch to a different
                # directory. Remember the old directory before
                # switching to the new one.
                #
                set pwd [ns_proxy eval $handle pwd]
                ns_proxy eval $handle [list cd $cd]
            }
            set exec_flags [expr {$ignorestderr_p ? "-ignorestderr --" : ""}]
            set return_string [ns_proxy eval $handle [list ::exec {*}$exec_flags {*}$call]]
        } finally {
            if {$reset_encoding_p} {
                ns_proxy eval $handle [list encoding system $proxy_encoding]
            }

            if {[info exists pwd]} {
                #
                # Switch back to the previous directory.
                #
                ns_proxy eval $handle [list cd $pwd]
            }
            ns_proxy release $handle
        }
        return $return_string
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: