lza_menace 1 year ago
parent 66b9552cd5
commit 3c1e1fcc59

@ -83,6 +83,7 @@ impl eframe::App for App {
if self.show_node_logs {
egui::ScrollArea::vertical().stick_to_bottom(true).show(ui, |ui| {
// ui.label(self.irc.read_irc_log(self.irc_active_channel.clone()));
self.node_log = self.node.read_log();
ui.horizontal(|ui| {
ui.text_edit_singleline(&mut self.node_log);
});

@ -10,7 +10,7 @@ mod node;
pub const TOR_DATA: &str = &"/tmp/tor-rust";
pub const TOR_LOG: &str = &"/tmp/tor-rust/tor.log";
pub const RADIO_STREAM: &str = &"radio.ogg";
pub const NODE_LOG: &str = &"node.log";
pub const NODE_LOG: &str = &"./node.log";
fn cleanup() {
let r: std::io::Result<()> = std::fs::remove_file(&RADIO_STREAM);

@ -1,4 +1,4 @@
use std::{io::{Read, BufReader}, process::{Command, Child}};
use std::{io::{BufReader, BufRead}, process::{Command}};
pub struct Node {
pub thread: std::thread::JoinHandle<()>,
@ -17,15 +17,19 @@ impl Node {
Self::new()
}
pub fn start(&self) -> Child {
let cmd = Command::new("wownerod")
// .arg("--detach")
// .arg("--non-interactive")
.arg("--log-file")
.arg(crate::NODE_LOG)
.spawn()
.expect("failed");
return cmd;
pub fn start(&self) -> () {
let t = std::thread::spawn(|| {
Command::new("wownerod")
.arg("--detach")
.arg("--non-interactive")
.arg("--log-file")
.arg(crate::NODE_LOG)
.arg("--log-level")
.arg("1")
.spawn()
.expect("failed");
});
return t.join().unwrap();
}
// --detach
@ -35,7 +39,7 @@ impl Node {
// --log-level
// --max-log-file-size
pub fn read_log() -> String {
pub fn read_log(&self) -> String {
let mut s: String = String::new();
let f = std::fs::File::open(crate::NODE_LOG); // ("unable to open irc log");
if f.is_err() { return "".to_owned() }