Implement ctrl+c for the du command (#1901)

* Implement ctrl+c for the du command

* Ignore the "too many arguments" Clippy warning
This commit is contained in:
Joseph T. Lyons
2020-05-27 00:52:20 -04:00
committed by GitHub
parent fa812849b8
commit 49b0592e3c
3 changed files with 27 additions and 8 deletions

View File

@ -112,6 +112,7 @@ impl Shell for FilesystemShell {
name_tag: Tag,
ctrl_c: Arc<AtomicBool>,
) -> Result<OutputStream, ShellError> {
let ctrl_c_copy = ctrl_c.clone();
let (path, p_tag) = match path {
Some(p) => {
let p_tag = p.tag;
@ -171,6 +172,7 @@ impl Shell for FilesystemShell {
short_names,
with_symlink_targets,
du,
ctrl_c.clone()
)
.map(|entry| ReturnSuccess::Value(entry.into()))?;
@ -178,7 +180,7 @@ impl Shell for FilesystemShell {
}
};
Ok(stream.interruptible(ctrl_c).to_output_stream())
Ok(stream.interruptible(ctrl_c_copy).to_output_stream())
}
fn cd(&self, args: CdArgs, name: Tag) -> Result<OutputStream, ShellError> {