Skip to content

Add support for fish_trace variable to trace execution - #6255

Merged
ridiculousfish merged 1 commit into
fish-shell:masterfrom
ridiculousfish:fish_trace
Nov 2, 2019
Merged

ridiculousfish merged 1 commit into
fish-shell:masterfrom
ridiculousfish:fish_trace

Conversation

@ridiculousfish

Copy link
Copy Markdown
Member

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; it looks a lot like the set -x of bash.

This is a basic facility for now; in the future we may make it fancier through interpreting 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 key bindings and autoloading is traced.

Fixes #3427

Screen Shot 2019-10-27 at 12 38 43 PM

@zx8

zx8 commented Oct 28, 2019

Copy link
Copy Markdown

This is fantastic! Presumably it can be set non-interactively at the start of some function to aid with debugging long-running or troublesome scripts?

Would be amazing if in future this could also support timing information to really help us drill down into where our scripts are slow (I'm thinking in terms of optimising startup time, config.fish, etc.)

@krobelus

Copy link
Copy Markdown
Contributor

Nice, this should be useful for quick debugging.

Events are also not traced because it is noisy. However key bindings and autoloading is traced.

It prints + emit fish_focus_in after each prompt here.
I guess that's because of bind --preset -M $mode \e\[I 'emit fish_focus_in' in shared bindings.

@zx8 fish --profile profile-file should work for analyzing execution time.

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 fish-shell#3427
@ridiculousfish

Copy link
Copy Markdown
Member Author

Let's suppress it for key bindings for now and see if anyone complains.

@ridiculousfish
ridiculousfish merged commit a7f1d2c into fish-shell:master Nov 2, 2019
@ridiculousfish
ridiculousfish deleted the fish_trace branch November 2, 2019 22:23
@ridiculousfish ridiculousfish added this to the fish 3.1.0 milestone Nov 2, 2019
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a way to toggle debug mode in Fish shell

3 participants