diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-08-24 17:17:36 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-08-24 17:17:36 -0400 |
commit | 701f728af722e8cbeca07c0815492aa2bc19484e (patch) | |
tree | 9308cbc50721b1b09c149f77f9da3b7964269c13 | |
parent | fcf869c4338faeeb146963e7aeae394b2e7b4dcb (diff) |
quit_to_cwd won't work if workers are busy
-rw-r--r-- | src/commands/quit.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/commands/quit.rs b/src/commands/quit.rs index 74e3422..9a5726a 100644 --- a/src/commands/quit.rs +++ b/src/commands/quit.rs @@ -22,6 +22,14 @@ pub fn force_quit(context: &mut AppContext) -> JoshutoResult<()> { } pub fn quit_to_current_directory(context: &mut AppContext) -> JoshutoResult<()> { - context.quit = QuitType::ToCurrentDirectory; + if worker_context.is_busy() || !worker_context.is_empty() { + Err(JoshutoError::new( + JoshutoErrorKind::Io(io::ErrorKind::Other), + String::from("operations running in background, use force_quit to quit"), + )) + } else { + context.quit = QuitType::ToCurrentDirectory; + Ok(()) + } Ok(()) } |