Disable terminal protocols before expanding wildcards

Commit 29f2da8d1 (Toggle terminal protocols lazily, 2024-05-16) made it so
the wildcard expansion in "echo **" (in a large directory tree) can't be
canceled with ctrl-c.  Fix this by disabling terminal protocols already at
expansion time (not waiting until execution).
This commit is contained in:
Johannes Altmanninger 2024-07-31 23:32:30 +02:00
parent 3be588569d
commit d21ed0fb22

View File

@ -448,7 +448,9 @@ mod expander {
use crate::{ use crate::{
common::scoped_push, common::scoped_push,
input_common::terminal_protocols_disable_ifn,
path::append_path_component, path::append_path_component,
threads::is_main_thread,
wutil::{dir_iter::DirIter, normalize_path, DevInode}, wutil::{dir_iter::DirIter, normalize_path, DevInode},
}; };
@ -592,6 +594,10 @@ mod expander {
} }
} }
if is_main_thread() {
terminal_protocols_disable_ifn();
}
// return "." and ".." entries if we're doing completions // return "." and ".." entries if we're doing completions
let Ok(mut dir) = self.open_dir( let Ok(mut dir) = self.open_dir(
base_dir, /* return . and .. */ base_dir, /* return . and .. */