Commit 61f8ef7
committed
reader: Fixed race condition where reader would be terminated before it
was properly initialized.
Currently, when reloading input very quickly (happens when updating the
prompt quickly with 'reload' bound to 'change') it is possible for the
reader's terminate method to be called before readFromCommand properly
spawns the new reader process. This means the process is never killed
and input is not reloaded until the process completes naturally or
another 'EvtSearchNew' is triggered.
An example where this becomes a problem is when using fzf with rg
integration and searching a large directory. Occasionally, the query
being processed by rg is not the same as the query displayed by fzf and
only after further modifying the query or waiting until rg finishes will
the input reload to the correct state. This commit introduces a
'started' condition that the terminate method will wait for before
trying to kill the process. The 'started' condition is signalled only
when the reader reaches a state where it can be safely terminated.1 parent ff16877 commit 61f8ef7
2 files changed
+44
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| |||
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
92 | 117 | | |
93 | 118 | | |
94 | 119 | | |
| |||
98 | 123 | | |
99 | 124 | | |
100 | 125 | | |
| 126 | + | |
101 | 127 | | |
102 | 128 | | |
103 | 129 | | |
| |||
220 | 246 | | |
221 | 247 | | |
222 | 248 | | |
| 249 | + | |
223 | 250 | | |
224 | 251 | | |
225 | 252 | | |
| |||
249 | 276 | | |
250 | 277 | | |
251 | 278 | | |
252 | | - | |
| 279 | + | |
253 | 280 | | |
254 | 281 | | |
255 | 282 | | |
| |||
290 | 317 | | |
291 | 318 | | |
292 | 319 | | |
293 | | - | |
| 320 | + | |
| 321 | + | |
294 | 322 | | |
295 | 323 | | |
296 | 324 | | |
| |||
0 commit comments