diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index a4a0773..2472901 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,11 +43,6 @@ fn get_offset() -> time::UtcOffset { } async fn async_main() -> anyhow::Result<()> { - if std::env::args().nth(1).as_deref() == Some("--internal-pipe-runner") { - pipe::run().await; - std::process::exit(0); - } - let mut input = textmode::Input::new().await?; let mut output = textmode::Output::new().await?; @@ -141,6 +136,16 @@ async fn async_main() -> anyhow::Result<()> { } fn main() { + if std::env::args().nth(1).as_deref() == Some("--internal-pipe-runner") { + match pipe::run() { + Ok(code) => std::process::exit(code), + Err(e) => { + eprintln!("nbsh: {}", e); + std::process::exit(1); + } + } + } + match async_std::task::block_on(async_main()) { Ok(_) => (), Err(e) => { |