@@ -6,6 +6,9 @@ set -g __async_prompt_tmpdir (command mktemp -d)
6
6
# Setup after the user defined prompt functions are loaded.
7
7
function __async_prompt_setup_on_startup --on-event fish_prompt
8
8
functions -e (status current-function )
9
+ if test " $async_prompt_enable " = 0
10
+ return 0
11
+ end
9
12
10
13
for func in (__async_prompt_config_functions)
11
14
function $func -V func
@@ -15,11 +18,13 @@ function __async_prompt_setup_on_startup --on-event fish_prompt
15
18
end
16
19
end
17
20
21
+ function __async_prompt_keep_last_pipestatus
22
+ set -g __async_prompt_last_pipestatus $pipestatus
23
+ end
24
+
18
25
not set -q async_prompt_on_variable
19
26
and set async_prompt_on_variable fish_bind_mode
20
27
function __async_prompt_fire --on-event fish_prompt (for var in $async_prompt_on_variable ; printf ' %s\ n' --on-variable $var ; end )
21
- set -l __async_prompt_last_pipestatus $pipestatus
22
-
23
28
for func in (__async_prompt_config_functions)
24
29
set -l tmpfile $_ _async_prompt_tmpdir' /' $fish_pid ' _' $func
25
30
@@ -28,7 +33,7 @@ function __async_prompt_fire --on-event fish_prompt (for var in $async_prompt_on
28
33
eval (string escape -- $func ' _loading_indicator' " $last_prompt " ) > $tmpfile
29
34
end
30
35
31
- __async_prompt_config_inherit_variables | __async_prompt_last_pipestatus= $_ _async_prompt_last_pipestatus __async_prompt_spawn \
36
+ __async_prompt_config_inherit_variables | __async_prompt_spawn \
32
37
$func ' | read -z prompt
33
38
echo -n $prompt >' $tmpfile
34
39
end
@@ -130,12 +135,10 @@ function __async_prompt_spawn -a cmd
130
135
true
131
136
end
132
137
' $cmd '
133
- __async_prompt_signal
134
- sleep 0.3
135
- __async_prompt_signal
136
- sleep 0.3
137
138
__async_prompt_signal' &
138
- disown
139
+ if test (__async_prompt_config_disown) = 1
140
+ disown
141
+ end
139
142
end
140
143
141
144
function __async_prompt_config_inherit_variables
@@ -181,6 +184,18 @@ function __async_prompt_config_internal_signal
181
184
end
182
185
end
183
186
187
+ function __async_prompt_config_disown
188
+ if test -z " $async_prompt_disown "
189
+ echo 1
190
+ else
191
+ echo " $async_prompt_disown "
192
+ end
193
+ end
194
+
184
195
function __async_prompt_repaint_prompt --on-signal (__async_prompt_config_internal_signal)
185
196
commandline -f repaint > /dev/null 2> /dev/null
186
197
end
198
+
199
+ function __async_prompt_tmpdir_cleanup --on-event fish_exit
200
+ rm -rf " $_ _async_prompt_tmpdir"
201
+ end
0 commit comments