1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-18 07:11:04 +02:00

refactor: swap out some code for existing macros

This commit is contained in:
Jake Stanger 2023-01-28 16:27:01 +00:00
parent ad97550583
commit 012762e102
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
5 changed files with 41 additions and 54 deletions

View file

@ -8,6 +8,7 @@ use serde::Deserialize;
use tokio::spawn;
use tokio::sync::mpsc::{Receiver, Sender};
use tracing::error;
use crate::try_send;
#[derive(Debug, Deserialize, Clone)]
pub struct ScriptModule {
@ -63,8 +64,8 @@ impl Module<Label> for ScriptModule {
spawn(async move {
script.run(move |(out, _)| match out {
OutputStream::Stdout(stdout) => {
tx.try_send(ModuleUpdateEvent::Update(stdout))
.expect("Failed to send stdout"); }
try_send!(tx, ModuleUpdateEvent::Update(stdout));
},
OutputStream::Stderr(stderr) => {
error!("{:?}", Report::msg(stderr)
.wrap_err("Watched script error:")