Skip to content

Commit 3fe7275

Browse files
authored
Merge pull request #40 from tesuji/bash-term
fix: set TERM for bash
2 parents 4334bff + 16ea4c7 commit 3fe7275

File tree

1 file changed

+7
-4
lines changed
  • crates/completest-pty/src

1 file changed

+7
-4
lines changed

crates/completest-pty/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ PROMPT='%% '
113113
pub fn complete(&mut self, input: &str, term: &Term) -> std::io::Result<String> {
114114
let mut command = Command::new("zsh");
115115
command.arg("--noglobalrcs");
116-
command.env("PATH", &self.path).env("ZDOTDIR", &self.home);
116+
command
117+
.env("PATH", &self.path)
118+
.env("TERM", "xterm")
119+
.env("ZDOTDIR", &self.home);
117120
let echo = false;
118121
comptest(command, echo, input, term, self.timeout)
119122
}
@@ -219,6 +222,7 @@ PS1='% '
219222
let inputrc_path = self.home.join(".inputrc");
220223
command
221224
.env("PATH", &self.path)
225+
.env("TERM", "xterm")
222226
.env("INPUTRC", &inputrc_path)
223227
.args([OsStr::new("--rcfile"), self.config.as_os_str()]);
224228
let echo = !input.contains("\t\t");
@@ -318,11 +322,10 @@ end;
318322
/// Get the output from typing `input` into the shell
319323
pub fn complete(&mut self, input: &str, term: &Term) -> std::io::Result<String> {
320324
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());
323325
command
324326
.env("PATH", &self.path)
325-
.env("TERM", &env_term)
327+
// fish requires TERM to be set.
328+
.env("TERM", "xterm")
326329
.env("XDG_CONFIG_HOME", &self.home);
327330
let echo = false;
328331
comptest(command, echo, input, term, self.timeout)

0 commit comments

Comments
 (0)