Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Preventing xtrace / -x from stepping through function from autoload'ed module



Hello again, thanks in advance for the help.

Documentation on "typeset" indicates that with the "-f" flag, "-ft"
should turn ON tracing for that function, and "-fT" should turn OFF
tracing for that function (as long as it is named).

However, quick experimentation doesn't align with my reading of the
docs -- "typeset -ft func" DOES work to enable tracing for that
function, but "typeset -fT func" does NOT disable tracing for that
function (when tracing is enabled globally via e.g. "set -x").

Are my expectations for "typeset -fT" out of line?  Its inverse,
"typeset -ft" does seem to work as I expect it to.

    #!/usr/bin/env zsh

    # Turn ON execution tracing
    set -x

    # Turn OFF execution tracing for the named function, before declaration
    typeset -fT hello

    hello() {
        echo "$@"
    }

    # Turn OFF execution tracing for the named function, after declaration
    # (not sure which order is intended so we try both.)
    typeset -fT hello

    # Testing shows that "hello" is traced, which is NOT expected
    hello "Should not be traced"

    # Turn ON function tracing for hello
    set +x
    typeset -ft hello

    # Testing shows that "hello" is traced, here as expected
    hello "Should be traced"


Zach Riggle




Messages sorted by: Reverse Date, Date, Thread, Author