mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-17 19:21:15 -03:00
Add support for fish_trace variable to trace execution
This adds support for `fish_trace`, a new variable intended to serve the same purpose as `set -x` as in bash. Setting this variable to anything non-empty causes execution to be traced. In the future we may give more specific meaning to the value of the variable. The user's prompt is not traced unless you run it explicitly. Events are also not traced because it is noisy; however autoloading is. Fixes #3427
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "reader.h"
|
||||
#include "redirection.h"
|
||||
#include "signal.h"
|
||||
#include "trace.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
/// File descriptor redirection error message.
|
||||
@@ -899,6 +900,12 @@ static bool exec_process_in_job(parser_t &parser, process_t *p, std::shared_ptr<
|
||||
// which depends on the redirection being evaluated before the pipe. So the write end of the
|
||||
// pipe comes first, the read pipe of the pipe comes last. See issue #966.
|
||||
|
||||
// Maybe trace this process.
|
||||
// TODO: 'and' and 'or' will not show.
|
||||
if (trace_enabled(parser)) {
|
||||
trace_argv(parser, nullptr, p->get_argv_array().to_list());
|
||||
}
|
||||
|
||||
// The IO chain for this process.
|
||||
io_chain_t process_net_io_chain = j->block_io_chain();
|
||||
if (pipes.write.valid()) {
|
||||
|
||||
Reference in New Issue
Block a user