|
|
|
@ -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() }
|
|
|
|
|