mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
fixed warnings in mers, but one warning in parse.rs will stay
This commit is contained in:
parent
c526912ecb
commit
dfd83fa581
@ -2,7 +2,7 @@ pub mod inlib;
|
|||||||
pub mod path;
|
pub mod path;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::HashMap,
|
||||||
io::{self, BufRead, BufReader, Read, Write},
|
io::{self, BufRead, BufReader, Read, Write},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Child, ChildStdin, ChildStdout, Command, Stdio},
|
process::{Child, ChildStdin, ChildStdout, Command, Stdio},
|
||||||
@ -55,11 +55,24 @@ sending data: (all ints are encoded so that the most significant data is sent FI
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Lib {
|
pub struct Lib {
|
||||||
|
name: String,
|
||||||
process: Child,
|
process: Child,
|
||||||
stdin: Arc<Mutex<ChildStdin>>,
|
stdin: Arc<Mutex<ChildStdin>>,
|
||||||
stdout: Arc<Mutex<BufReader<ChildStdout>>>,
|
stdout: Arc<Mutex<BufReader<ChildStdout>>>,
|
||||||
pub registered_fns: Vec<(String, Vec<VType>, VType)>,
|
pub registered_fns: Vec<(String, Vec<VType>, VType)>,
|
||||||
}
|
}
|
||||||
|
impl Drop for Lib {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if self.process.try_wait().is_err() {
|
||||||
|
if let Err(e) = self.process.kill() {
|
||||||
|
eprint!(
|
||||||
|
"Warn: tried to kill lib process for library \"{}\", but failed: {e:?}",
|
||||||
|
self.name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
impl Lib {
|
impl Lib {
|
||||||
pub fn launch(
|
pub fn launch(
|
||||||
mut exec: Command,
|
mut exec: Command,
|
||||||
@ -131,6 +144,7 @@ impl Lib {
|
|||||||
}
|
}
|
||||||
writeln!(stdin, "init_finished").unwrap();
|
writeln!(stdin, "init_finished").unwrap();
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
name: name.to_string(),
|
||||||
process: handle,
|
process: handle,
|
||||||
stdin: Arc::new(Mutex::new(stdin)),
|
stdin: Arc::new(Mutex::new(stdin)),
|
||||||
stdout: Arc::new(Mutex::new(stdout)),
|
stdout: Arc::new(Mutex::new(stdout)),
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
use std::{
|
use std::{fs, sync::Arc, time::Instant};
|
||||||
fs,
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
time::Instant,
|
|
||||||
};
|
|
||||||
|
|
||||||
use notify::Watcher as FsWatcher;
|
use notify::Watcher as FsWatcher;
|
||||||
|
|
||||||
@ -10,6 +6,8 @@ pub mod libs;
|
|||||||
pub mod parse;
|
pub mod parse;
|
||||||
pub mod script;
|
pub mod script;
|
||||||
|
|
||||||
|
// necessary because the lib target in Cargo.toml also points here. TODO: update Cargo.toml to have a lib target that is separate from the bin one (=> doesn't point to main)
|
||||||
|
#[allow(unused)]
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<_> = std::env::args().skip(1).collect();
|
let args: Vec<_> = std::env::args().skip(1).collect();
|
||||||
let path = std::env::args().nth(1).unwrap();
|
let path = std::env::args().nth(1).unwrap();
|
||||||
|
@ -8,7 +8,7 @@ use std::{
|
|||||||
|
|
||||||
use crate::libs;
|
use crate::libs;
|
||||||
|
|
||||||
use self::to_runnable::{GInfo, ToRunnableError};
|
use self::to_runnable::ToRunnableError;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
builtins::BuiltinFunction,
|
builtins::BuiltinFunction,
|
||||||
|
@ -2,4 +2,3 @@ pub mod block;
|
|||||||
pub mod builtins;
|
pub mod builtins;
|
||||||
pub mod val_data;
|
pub mod val_data;
|
||||||
pub mod val_type;
|
pub mod val_type;
|
||||||
pub mod value;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user