This commit is contained in:
John Smith 2022-07-02 11:41:25 -04:00
parent d96e5a131c
commit e31aa84db0
8 changed files with 32 additions and 77 deletions

47
Cargo.lock generated
View File

@ -369,7 +369,7 @@ dependencies = [
"futures-io",
"futures-util",
"log",
"pin-project 0.4.29",
"pin-project 0.4.30",
"tungstenite 0.11.1",
]
@ -1217,10 +1217,8 @@ dependencies = [
"lazy_static",
"libc",
"log",
"maplit",
"ncurses",
"signal-hook",
"term_size",
"tokio",
"unicode-segmentation",
"unicode-width",
]
@ -1265,6 +1263,7 @@ dependencies = [
"num 0.4.0",
"owning_ref",
"time 0.3.11",
"tokio",
"toml",
"unicode-segmentation",
"unicode-width",
@ -2641,17 +2640,6 @@ dependencies = [
"socket2",
]
[[package]]
name = "ncurses"
version = "5.101.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e2c5d34d72657dc4b638a1c25d40aae81e4f1c699062f72f467237920752032"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]
name = "ndk"
version = "0.6.0"
@ -3273,11 +3261,11 @@ dependencies = [
[[package]]
name = "pin-project"
version = "0.4.29"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909"
checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a"
dependencies = [
"pin-project-internal 0.4.29",
"pin-project-internal 0.4.30",
]
[[package]]
@ -3291,9 +3279,9 @@ dependencies = [
[[package]]
name = "pin-project-internal"
version = "0.4.29"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a"
checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e"
dependencies = [
"proc-macro2",
"quote",
@ -4348,16 +4336,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "term_size"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.3"
@ -4549,6 +4527,7 @@ checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45"
dependencies = [
"bytes 1.1.0",
"futures-core",
"futures-io",
"futures-sink",
"pin-project-lite",
"tokio",
@ -5004,7 +4983,7 @@ dependencies = [
"flexi_logger",
"futures",
"log",
"parking_lot 0.12.1",
"parking_lot 0.11.2",
"serde",
"serde_derive",
"serial_test",
@ -5090,7 +5069,7 @@ dependencies = [
"thiserror",
"tokio",
"tokio-stream",
"tokio-util 0.6.10",
"tokio-util 0.7.3",
"tracing",
"tracing-error",
"tracing-subscriber",
@ -5131,7 +5110,7 @@ dependencies = [
"serde_json",
"tokio",
"tokio-stream",
"tokio-util 0.6.10",
"tokio-util 0.7.3",
"tracing",
"tracing-opentelemetry",
"tracing-subscriber",
@ -5174,7 +5153,7 @@ dependencies = [
"stop-token",
"tokio",
"tokio-stream",
"tokio-util 0.6.10",
"tokio-util 0.7.3",
"tracing",
"tracing-appender",
"tracing-journald",

View File

@ -12,16 +12,11 @@ path = "src/main.rs"
[features]
default = [ "rt-tokio" ]
rt-async-std = [ "async-std", "veilid-core/rt-async-std" ]
rt-tokio = [ "tokio", "tokio-util", "veilid-core/rt-tokio" ]
[target.'cfg(unix)'.dependencies]
cursive = { path = "../external/cursive/cursive", default-features = false, features = ["ncurses-backend", "toml", "rt-async-std"]}
[target.'cfg(not(unix))'.dependencies]
cursive = { path = "../external/cursive/cursive", default-features = false, features = ["crossterm-backend", "toml", "rt-async-std"]}
rt-async-std = [ "async-std", "veilid-core/rt-async-std", "cursive/rt-async-std" ]
rt-tokio = [ "tokio", "tokio-util", "veilid-core/rt-tokio", "cursive/rt-tokio" ]
[dependencies]
cursive = { path = "../external/cursive/cursive", default-features = false, features = [ "crossterm", "toml"]}
async-std = { version = "^1.9", features = ["unstable", "attributes"], optional = true }
tokio = { version = "^1", features = ["full"], optional = true }
tokio-util = { version = "^0", features = ["compat"], optional = true}

View File

@ -104,6 +104,7 @@ fn main() -> Result<(), String> {
specbuilder.module("cursive", LevelFilter::Off);
specbuilder.module("cursive_core", LevelFilter::Off);
specbuilder.module("cursive_buffered_backend", LevelFilter::Off);
specbuilder.module("tokio_util", LevelFilter::Off);
specbuilder.module("mio", LevelFilter::Off);
specbuilder.module("async_std", LevelFilter::Off);
specbuilder.module("async_io", LevelFilter::Off);

View File

@ -16,7 +16,7 @@ logging:
enabled: false
file:
enabled: true
directory: "%LOGGING_FILE_DIRECTORY%"
directory: '%LOGGING_FILE_DIRECTORY%'
append: true
interface:
node_log:

View File

@ -649,31 +649,13 @@ impl UI {
cursive_flexi_logger_view::resize(node_log_scrollback);
// Instantiate the cursive runnable
let runnable;
cfg_if::cfg_if! {
if #[cfg(unix)] {
runnable = CursiveRunnable::new(
|| -> Result<Box<dyn cursive_buffered_backend::Backend>, Box<DumbError>> {
let ncurses_backend = cursive::backends::curses::n::Backend::init().unwrap();
let buffered_backend =
cursive_buffered_backend::BufferedBackend::new(ncurses_backend);
Ok(Box::new(buffered_backend))
},
);
} else {
runnable = CursiveRunnable::new(
|| -> Result<Box<dyn cursive_buffered_backend::Backend>, Box<DumbError>> {
let crossterm_backend = cursive::backends::crossterm::Backend::init().unwrap();
let buffered_backend =
cursive_buffered_backend::BufferedBackend::new(crossterm_backend);
Ok(Box::new(buffered_backend))
},
);
}
}
//let runnable = cursive::default();
let runnable = CursiveRunnable::new(
|| -> Result<Box<dyn cursive_buffered_backend::Backend>, Box<DumbError>> {
let backend = cursive::backends::crossterm::Backend::init().unwrap();
let buffered_backend = cursive_buffered_backend::BufferedBackend::new(backend);
Ok(Box::new(buffered_backend))
},
);
// Make the callback mechanism easily reachable
let cb_sink = runnable.cb_sink().clone();

View File

@ -1,5 +1,4 @@
use crate::xx::*;
use crate::*;
use core::fmt;
mod tools;

View File

@ -205,8 +205,8 @@ cfg_if::cfg_if! {
Ok(())
}
} else if #[cfg(windows)] {
use std::os::windows::fs::MetadataExt;
use windows_permissions::*;
//use std::os::windows::fs::MetadataExt;
//use windows_permissions::*;
pub fn ensure_file_private_owner<P:AsRef<Path>>(path: P) -> Result<(),String>
{
@ -217,11 +217,11 @@ cfg_if::cfg_if! {
// let uid = Uid::effective();
// let gid = Gid::effective();
let meta = std::fs::metadata(path).map_err(|e| format!("unable to get metadata for path '{:?}': {}",path, e))?;
//let meta = std::fs::metadata(path).map_err(|e| format!("unable to get metadata for path '{:?}': {}",path, e))?;
if meta.mode() != 0o600 {
std::fs::set_permissions(path,std::fs::Permissions::from_mode(0o600)).map_err(|e| format!("unable to set correct permissions on path '{:?}': {}", path, e))?;
}
//if meta.mode() != 0o600 {
// std::fs::set_permissions(path,std::fs::Permissions::from_mode(0o600)).map_err(|e| format!("unable to set correct permissions on path '{:?}': {}", path, e))?;
//}
//if meta.uid() != uid.as_raw() || meta.gid() != gid.as_raw() {
// chown(path, Some(uid), Some(gid)).map_err(|e| format!("unable to set correct owner on path '{:?}': {}", path, e))?;

View File

@ -1,9 +1,8 @@
use crate::settings::*;
use crate::tools::*;
use clap::ArgMatches;
use log::*;
use std::ffi::OsString;
use std::time::Duration;
use tracing::*;
use windows_service::service::{
ServiceControl, ServiceControlAccept, ServiceExitCode, ServiceState, ServiceStatus, ServiceType,
};