(matches: Matches)
| 68 | } |
| 69 | |
| 70 | fn app_main(matches: Matches) -> Result<i32> { |
| 71 | let mut console_spec = matches.opt_str("console"); |
| 72 | |
| 73 | let gpio_pins_spec = matches.opt_str("gpio-pins"); |
| 74 | |
| 75 | let service_url = matches |
| 76 | .opt_str("service-url") |
| 77 | .unwrap_or_else(|| endbasic_client::PROD_API_ADDRESS.to_owned()); |
| 78 | |
| 79 | let app_mode = AppMode::from_matches(matches)?; |
| 80 | if let AppMode::RunScript(path) = &app_mode { |
| 81 | let propline = extract_propline(path)?; |
| 82 | if console_spec.is_none() { |
| 83 | console_spec = propline.console_spec; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | let (signals_tx, signals_rx) = async_channel::unbounded(); |
| 88 | let (console_host, console_factory) = |
| 89 | setup_console(console_spec.as_deref(), signals_tx.clone())?; |
| 90 | |
| 91 | let interpreter = thread::spawn(move || -> Result<i32> { |
| 92 | let runtime = tokio::runtime::Runtime::new()?; |
| 93 | runtime.block_on(async move { |
| 94 | async_app_main( |
| 95 | app_mode, |
| 96 | console_factory, |
| 97 | (signals_tx, signals_rx), |
| 98 | gpio_pins_spec, |
| 99 | service_url, |
| 100 | ) |
| 101 | .await |
| 102 | }) |
| 103 | }); |
| 104 | |
| 105 | console_host.run()?; |
| 106 | interpreter.join().expect("Interpreter thread shoult not have panicked") |
| 107 | } |
| 108 | |
| 109 | app!("EndBASIC", app_build, app_main); |
nothing calls this directly
no test coverage detected