Wait for SetEnv

This commit is contained in:
Lucy 2022-07-11 10:47:00 -04:00
parent de3ab99743
commit 07c811ba97
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
2 changed files with 24 additions and 10 deletions

View file

@ -9,7 +9,7 @@ mod process;
use async_signals::Signals;
use color_eyre::{eyre::WrapErr, Result};
use futures_util::StreamExt;
use tokio::sync::mpsc;
use tokio::sync::{mpsc, oneshot};
use tokio_util::sync::CancellationToken;
use tracing::metadata::LevelFilter;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
@ -32,11 +32,15 @@ async fn main() -> Result<()> {
let token = CancellationToken::new();
let (socket_tx, socket_rx) = mpsc::unbounded_channel();
if let Err(err) = comp::run_compositor(token.child_token(), socket_rx) {
let (env_tx, env_rx) = oneshot::channel();
if let Err(err) = comp::run_compositor(token.child_token(), socket_rx, env_tx) {
error!("compositor errored: {:?}", err);
}
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
let env_vars = Vec::new();
let env_vars = env_rx
.await
.expect("failed to receive environmental variables")
.into_iter()
.collect::<Vec<_>>();
info!("got environmental variables: {:?}", env_vars);
let mut sockets = Vec::with_capacity(2);