aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/main.rs
diff options
context:
space:
mode:
authorCole Helbling2021-11-15 04:06:12 +0000
committerGitHub2021-11-15 04:06:12 +0000
commit87e61a0894d6af1838c5d288fae83279004026fb (patch)
tree8f394c31c527a470bed62109d9def43da9bd663a /helix-term/src/main.rs
parentf5e070e808d2edaeae04497c01f5a0f813407956 (diff)
helix-term/commands: implement cquit (#1096)
This allows you to exit helix with an exit code, e.g. `:cq 2`.
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r--helix-term/src/main.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index 3ae4f7c9..6fa1ce67 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -38,8 +38,13 @@ fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> {
Ok(())
}
+fn main() -> Result<()> {
+ let exit_code = main_impl()?;
+ std::process::exit(exit_code);
+}
+
#[tokio::main]
-async fn main() -> Result<()> {
+async fn main_impl() -> Result<i32> {
let cache_dir = helix_core::cache_dir();
if !cache_dir.exists() {
std::fs::create_dir_all(&cache_dir).ok();
@@ -109,7 +114,8 @@ FLAGS:
// TODO: use the thread local executor to spawn the application task separately from the work pool
let mut app = Application::new(args, config).context("unable to create new application")?;
- app.run().await.unwrap();
- Ok(())
+ let exit_code = app.run().await?;
+
+ Ok(exit_code)
}