@@ -74,7 +74,7 @@ impl ZshRuntime {
74
74
let config_path = home. join ( ".zshenv" ) ;
75
75
let config = "\
76
76
fpath=($fpath $ZDOTDIR/zsh)
77
- autoload -U +X compinit && compinit
77
+ autoload -U +X compinit && compinit -u # bypass compaudit security checking
78
78
precmd_functions=\" \" # avoid the prompt being overwritten
79
79
PS1='%% '
80
80
PROMPT='%% '
@@ -170,17 +170,22 @@ impl BashRuntime {
170
170
std:: fs:: create_dir_all ( & home) ?;
171
171
172
172
let config_path = home. join ( ".bashrc" ) ;
173
+ let inputrc_path = home. join ( ".inputrc" ) ;
173
174
let config = "\
174
175
PS1='% '
175
176
. /etc/bash_completion
176
177
"
177
178
. to_owned ( ) ;
178
179
std:: fs:: write ( config_path, config) ?;
180
+ // Ignore ~/.inputrc which may set vi edit mode.
181
+ std:: fs:: write (
182
+ inputrc_path,
183
+ "# expected empty file to disable loading ~/.inputrc\n " ,
184
+ ) ?;
179
185
180
186
Self :: with_home ( bin_root, home)
181
187
}
182
188
183
- /// Reuse an existing runtime's home
184
189
/// Reuse an existing runtime's home
185
190
pub fn with_home ( bin_root : PathBuf , home : PathBuf ) -> std:: io:: Result < Self > {
186
191
let config_path = home. join ( ".bashrc" ) ;
@@ -211,8 +216,10 @@ PS1='% '
211
216
/// Get the output from typing `input` into the shell
212
217
pub fn complete ( & mut self , input : & str , term : & Term ) -> std:: io:: Result < String > {
213
218
let mut command = Command :: new ( "bash" ) ;
219
+ let inputrc_path = self . home . join ( ".inputrc" ) ;
214
220
command
215
221
. env ( "PATH" , & self . path )
222
+ . env ( "INPUTRC" , & inputrc_path)
216
223
. args ( [ OsStr :: new ( "--rcfile" ) , self . config . as_os_str ( ) ] ) ;
217
224
let echo = !input. contains ( "\t \t " ) ;
218
225
comptest ( command, echo, input, term, self . timeout )
@@ -311,8 +318,11 @@ end;
311
318
/// Get the output from typing `input` into the shell
312
319
pub fn complete ( & mut self , input : & str , term : & Term ) -> std:: io:: Result < String > {
313
320
let mut command = Command :: new ( "fish" ) ;
321
+ // fish requires TERM to be set.
322
+ let env_term = std:: env:: var_os ( "TERM" ) . unwrap_or_else ( || "dumb" . into ( ) ) ;
314
323
command
315
324
. env ( "PATH" , & self . path )
325
+ . env ( "TERM" , & env_term)
316
326
. env ( "XDG_CONFIG_HOME" , & self . home ) ;
317
327
let echo = false ;
318
328
comptest ( command, echo, input, term, self . timeout )
0 commit comments