Autoload: Call the parser directly instead of going via "subshell"

This used to call exec_subshell, which has two issues:

1. It creates a command substitution block which shows up in a stack
trace
2. It does much more work than necessary

This removes a useless "in command substitution" from an error message
in an autoloaded file, and it speeds up autoloading a bit (not
measurable in actual benchmarks, but microbenchmarks are 2x).
This commit is contained in:
Fabian Homborg
2022-03-23 17:33:24 +01:00
committed by Fabian Boehm
parent b83d8dc8c0
commit cc689290cd
2 changed files with 21 additions and 1 deletions

View File

@@ -32,3 +32,15 @@ $fish -c 'echo "unfinished "$(subshell' 2>| string replace -r '.*' '<$0>'
# CHECK: <fish: Unexpected end of string, expecting ')'>
# CHECK: <echo "unfinished "$(subshell>
# CHECK: < ^>
echo "function error" >$TMPDIR/error.fish
$fish -c "set -g fish_function_path $(string escape $TMPDIR); error"
# CHECKERR: ~/temp/error.fish (line 1): Missing end to balance this function definition
# CHECKERR: function error
# CHECKERR: ^
# CHECKERR: from sourcing file ~/temp/error.fish
# CHECKERR: source: Error while reading file '{{.*}}/error.fish'
# CHECKERR: fish: Unknown command: error
# CHECKERR: fish:
# CHECKERR: set -g fish_function_path {{.*}}; error
# CHECKERR: ^