janetsh icon indicating copy to clipboard operation
janetsh copied to clipboard

Child execution debug printing tracing/hooks

Open andrewchambers opened this issue 6 years ago • 0 comments

I recently wanted to print out all the commands a script was executing (A C build script) - It was very hard to do so, In bash you do something like:

verbose () {
  echo "$@"
  "$@"
}

verbose cc foo.c ...

In janet I am not sure the right approach, but perhaps a dynamic variable that can be set to control a debug callback then users can define a macro like 'with-verbose'

(with-verbose (do (sh/$ cc ...) (sh/$ cc ...) (sh/$ cc ...)))

An alternative is to integrate with the janet vm trace functions by providing a clear trace point.

andrewchambers avatar May 31 '19 04:05 andrewchambers