Update most Cargo dependencies

pull/144/head
Manos Pitsidianakis 2022-05-02 15:44:39 +03:00
parent 2eb22a290a
commit 2c23ca34cd
17 changed files with 873 additions and 716 deletions

1424
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -27,10 +27,10 @@ path = "src/bin.rs"
[dependencies] [dependencies]
xdg = "2.1.0" xdg = "2.1.0"
crossbeam = "0.7.2" crossbeam = "^0.8"
signal-hook = "0.1.12" signal-hook = "^0.3"
signal-hook-registry = "1.2.0" signal-hook-registry = "1.2.0"
nix = "0.17.0" nix = "^0.24"
melib = { path = "melib", version = "0.7.2" } melib = { path = "melib", version = "0.7.2" }
serde = "1.0.71" serde = "1.0.71"
@ -38,20 +38,19 @@ serde_derive = "1.0.71"
serde_json = "1.0" serde_json = "1.0"
toml = { version = "0.5.6", features = ["preserve_order", ] } toml = { version = "0.5.6", features = ["preserve_order", ] }
indexmap = { version = "^1.6", features = ["serde-1", ] } indexmap = { version = "^1.6", features = ["serde-1", ] }
linkify = "0.4.0" linkify = "^0.8"
notify = "4.0.1" # >:c notify = "4.0.1" # >:c
termion = "1.5.1" termion = "1.5.1"
bincode = "^1.3.0" bincode = "^1.3.0"
uuid = { version = "0.8.1", features = ["serde", "v4"] }
unicode-segmentation = "1.2.1" # >:c unicode-segmentation = "1.2.1" # >:c
libc = {version = "0.2.59", features = ["extra_traits",]} libc = {version = "0.2.125", features = ["extra_traits",]}
smallvec = { version = "^1.5.0", features = ["serde", ] } smallvec = { version = "^1.5.0", features = ["serde", ] }
bitflags = "1.0" bitflags = "1.0"
pcre2 = { version = "0.2.3", optional = true } pcre2 = { version = "0.2.3", optional = true }
structopt = { version = "0.3.14", default-features = false } structopt = { version = "0.3.14", default-features = false }
svg_crate = { version = "0.8.0", optional = true, package = "svg" } svg_crate = { version = "^0.10", optional = true, package = "svg" }
futures = "0.3.5" futures = "0.3.5"
async-task = "3.0.0" async-task = "^4.2.0"
num_cpus = "1.12.0" num_cpus = "1.12.0"
flate2 = { version = "1.0.16", optional = true } flate2 = { version = "1.0.16", optional = true }
@ -59,9 +58,9 @@ flate2 = { version = "1.0.16", optional = true }
notify-rust = { version = "^4", optional = true } notify-rust = { version = "^4", optional = true }
[build-dependencies] [build-dependencies]
syn = { version = "1.0.31", features = [] } syn = { version = "1.0.92", features = [] }
quote = "^1.0" quote = "^1.0"
proc-macro2 = "1.0.18" proc-macro2 = "1.0.37"
flate2 = { version = "1.0.16", optional = true } flate2 = { version = "1.0.16", optional = true }
[dev-dependencies] [dev-dependencies]

View File

@ -48,18 +48,18 @@
##subscribed_mailboxes = ["INBOX", "INBOX/Sent", "INBOX/Drafts", "INBOX/Junk"] ##subscribed_mailboxes = ["INBOX", "INBOX/Sent", "INBOX/Drafts", "INBOX/Junk"]
# #
## Setting up an account for an already existing notmuch database ## Setting up an account for an already existing notmuch database
#[accounts.notmuch] ##[accounts.notmuch]
#root_mailbox = "/path/to/folder" # where .notmuch/ directory is located ##root_mailbox = "/path/to/folder" # where .notmuch/ directory is located
#format = "notmuch" ##format = "notmuch"
#listing.index_style = "conversations" ##listing.index_style = "conversations"
#identity="username@example.com" ##identity="username@example.com"
#display_name = "Name Name" ##display_name = "Name Name"
# # notmuch mailboxes are virtual, they are defined by their alias and the notmuch query that corresponds to their content. ## # notmuch mailboxes are virtual, they are defined by their alias and the notmuch query that corresponds to their content.
# [accounts.notmuch.mailboxes] ## [accounts.notmuch.mailboxes]
# "INBOX" = { query="tag:inbox", subscribe = true } ## "INBOX" = { query="tag:inbox", subscribe = true }
# "Drafts" = { query="tag:draft", subscribe = true } ## "Drafts" = { query="tag:draft", subscribe = true }
# "Sent" = { query="from:username@example.com from:username2@example.com", subscribe = true } ## "Sent" = { query="from:username@example.com from:username2@example.com", subscribe = true }
# ##
## Setting up a Gmail account ## Setting up a Gmail account
#[accounts."gmail"] #[accounts."gmail"]
#root_mailbox = '[Gmail]' #root_mailbox = '[Gmail]'

View File

@ -22,7 +22,7 @@ path = "src/lib.rs"
bitflags = "1.0" bitflags = "1.0"
data-encoding = "2.1.1" data-encoding = "2.1.1"
encoding = "0.2.33" encoding = "0.2.33"
nom = { version = "5.1.1" } nom = { version = "5" }
indexmap = { version = "^1.5", features = ["serde-1", ] } indexmap = { version = "^1.5", features = ["serde-1", ] }
notify = { version = "4.0.15", optional = true } notify = { version = "4.0.15", optional = true }
@ -31,21 +31,21 @@ native-tls = { version ="0.2.3", optional=true }
serde = { version = "1.0.71", features = ["rc", ] } serde = { version = "1.0.71", features = ["rc", ] }
serde_derive = "1.0.71" serde_derive = "1.0.71"
bincode = "^1.3.0" bincode = "^1.3.0"
uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] } uuid = { version = "^1", features = ["serde", "v4", "v5"] }
unicode-segmentation = { version = "1.2.1", optional = true } unicode-segmentation = { version = "1.2.1", optional = true }
libc = {version = "0.2.59", features = ["extra_traits",]} libc = {version = "0.2.125", features = ["extra_traits",]}
isahc = { version = "0.9.7", optional = true, default-features = false, features = ["http2", "json", "text-decoding"]} isahc = { version = "^1.7", optional = true, default-features = false, features = ["http2", "json", "text-decoding"]}
serde_json = { version = "1.0", optional = true, features = ["raw_value",] } serde_json = { version = "1.0", optional = true, features = ["raw_value",] }
smallvec = { version = "^1.5.0", features = ["serde", ] } smallvec = { version = "^1.5.0", features = ["serde", ] }
nix = "0.17.0" nix = "^0.24"
rusqlite = {version = "0.24.0", optional = true } rusqlite = {version = "^0.27", optional = true }
libloading = "0.6.2" libloading = "^0.7"
futures = "0.3.5" futures = "0.3.5"
smol = "1.0.0" smol = "1.0.0"
async-stream = "0.2.1" async-stream = "^0.3"
base64 = { version = "0.12.3", optional = true } base64 = { version = "^0.13", optional = true }
flate2 = { version = "1.0.16", optional = true } flate2 = { version = "1.0.16", optional = true }
xdg-utils = "^0.4.0" xdg-utils = "^0.4.0"

View File

@ -160,7 +160,7 @@ impl Backends {
let dlpath = "libnotmuch.so.5"; let dlpath = "libnotmuch.so.5";
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let dlpath = "libnotmuch.5.dylib"; let dlpath = "libnotmuch.5.dylib";
if libloading::Library::new(dlpath).is_ok() { if unsafe { libloading::Library::new(dlpath) }.is_ok() {
b.register( b.register(
"notmuch".to_string(), "notmuch".to_string(),
Backend { Backend {

View File

@ -69,6 +69,7 @@ pub use thread::*;
#[derive(Debug)] #[derive(Debug)]
pub struct DbConnection { pub struct DbConnection {
#[allow(dead_code)]
pub lib: Arc<libloading::Library>, pub lib: Arc<libloading::Library>,
pub inner: Arc<RwLock<*mut notmuch_database_t>>, pub inner: Arc<RwLock<*mut notmuch_database_t>>,
pub revision_uuid: Arc<RwLock<u64>>, pub revision_uuid: Arc<RwLock<u64>>,
@ -215,6 +216,7 @@ impl Drop for DbConnection {
#[derive(Debug)] #[derive(Debug)]
pub struct NotmuchDb { pub struct NotmuchDb {
#[allow(dead_code)]
lib: Arc<libloading::Library>, lib: Arc<libloading::Library>,
revision_uuid: Arc<RwLock<u64>>, revision_uuid: Arc<RwLock<u64>>,
mailboxes: Arc<RwLock<HashMap<MailboxHash, NotmuchMailbox>>>, mailboxes: Arc<RwLock<HashMap<MailboxHash, NotmuchMailbox>>>,
@ -311,7 +313,7 @@ impl NotmuchDb {
let dlpath = "libnotmuch.so.5"; let dlpath = "libnotmuch.so.5";
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let dlpath = "libnotmuch.5.dylib"; let dlpath = "libnotmuch.5.dylib";
let lib = Arc::new(libloading::Library::new(dlpath)?); let lib = Arc::new(unsafe { libloading::Library::new(dlpath)? });
let path = Path::new(s.root_mailbox.as_str()).expand(); let path = Path::new(s.root_mailbox.as_str()).expand();
if !path.exists() { if !path.exists() {
return Err(MeliError::new(format!( return Err(MeliError::new(format!(
@ -862,6 +864,7 @@ struct NotmuchOp {
collection: Collection, collection: Collection,
database: Arc<DbConnection>, database: Arc<DbConnection>,
bytes: Option<Vec<u8>>, bytes: Option<Vec<u8>>,
#[allow(dead_code)]
lib: Arc<libloading::Library>, lib: Arc<libloading::Library>,
} }
@ -886,6 +889,7 @@ impl BackendOp for NotmuchOp {
} }
pub struct Query<'s> { pub struct Query<'s> {
#[allow(dead_code)]
lib: Arc<libloading::Library>, lib: Arc<libloading::Library>,
ptr: *mut notmuch_query_t, ptr: *mut notmuch_query_t,
query_str: &'s str, query_str: &'s str,

View File

@ -91,9 +91,7 @@ impl Connection {
!nix::fcntl::OFlag::O_NONBLOCK !nix::fcntl::OFlag::O_NONBLOCK
}), }),
) )
.map_err(|err| { .map_err(|err| std::io::Error::from_raw_os_error(err as i32))?;
std::io::Error::from_raw_os_error(err.as_errno().map(|n| n as i32).unwrap_or(0))
})?;
Ok(()) Ok(())
} }
#[cfg(feature = "deflate_compression")] #[cfg(feature = "deflate_compression")]

View File

@ -213,9 +213,8 @@ impl Drop for ContextInner {
impl Context { impl Context {
pub fn new() -> Result<Self> { pub fn new() -> Result<Self> {
let lib = Arc::new(libloading::Library::new(libloading::library_filename( let lib =
"gpgme", Arc::new(unsafe { libloading::Library::new(libloading::library_filename("gpgme")) }?);
))?);
if unsafe { call!(&lib, gpgme_check_version)(GPGME_VERSION.as_bytes().as_ptr() as *mut _) } if unsafe { call!(&lib, gpgme_check_version)(GPGME_VERSION.as_bytes().as_ptr() as *mut _) }
.is_null() .is_null()
{ {

View File

@ -34,7 +34,7 @@ use std::path::PathBuf;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate linkify; extern crate linkify;
extern crate uuid; pub(crate) use melib::uuid;
extern crate bitflags; extern crate bitflags;
extern crate serde_json; extern crate serde_json;
@ -84,18 +84,17 @@ fn notify(
sender: crossbeam::channel::Sender<ThreadEvent>, sender: crossbeam::channel::Sender<ThreadEvent>,
) -> std::result::Result<crossbeam::channel::Receiver<c_int>, std::io::Error> { ) -> std::result::Result<crossbeam::channel::Receiver<c_int>, std::io::Error> {
use std::time::Duration; use std::time::Duration;
let (alarm_pipe_r, alarm_pipe_w) = nix::unistd::pipe().map_err(|err| { let (alarm_pipe_r, alarm_pipe_w) =
std::io::Error::from_raw_os_error(err.as_errno().map(|n| n as i32).unwrap_or(0)) nix::unistd::pipe().map_err(|err| std::io::Error::from_raw_os_error(err as i32))?;
})?;
let alarm_handler = move |info: &nix::libc::siginfo_t| { let alarm_handler = move |info: &nix::libc::siginfo_t| {
let value = unsafe { info.si_value().sival_ptr as u8 }; let value = unsafe { info.si_value().sival_ptr as u8 };
let _ = nix::unistd::write(alarm_pipe_w, &[value]); let _ = nix::unistd::write(alarm_pipe_w, &[value]);
}; };
unsafe { unsafe {
signal_hook_registry::register_sigaction(signal_hook::SIGALRM, alarm_handler)?; signal_hook_registry::register_sigaction(signal_hook::consts::SIGALRM, alarm_handler)?;
} }
let (s, r) = crossbeam::channel::bounded(100); let (s, r) = crossbeam::channel::bounded(100);
let signals = signal_hook::iterator::Signals::new(signals)?; let mut signals = signal_hook::iterator::Signals::new(signals)?;
let _ = nix::fcntl::fcntl( let _ = nix::fcntl::fcntl(
alarm_pipe_r, alarm_pipe_r,
nix::fcntl::FcntlArg::F_SETFL(nix::fcntl::OFlag::O_NONBLOCK), nix::fcntl::FcntlArg::F_SETFL(nix::fcntl::OFlag::O_NONBLOCK),
@ -344,9 +343,9 @@ fn run_app(opt: Opt) -> Result<()> {
/* Catch SIGWINCH to handle terminal resizing */ /* Catch SIGWINCH to handle terminal resizing */
let signals = &[ let signals = &[
/* Catch SIGWINCH to handle terminal resizing */ /* Catch SIGWINCH to handle terminal resizing */
signal_hook::SIGWINCH, signal_hook::consts::SIGWINCH,
/* Catch SIGCHLD to handle embed applications status change */ /* Catch SIGCHLD to handle embed applications status change */
signal_hook::SIGCHLD, signal_hook::consts::SIGCHLD,
]; ];
let signal_recvr = notify(signals, sender.clone())?; let signal_recvr = notify(signals, sender.clone())?;
@ -529,14 +528,14 @@ fn run_app(opt: Opt) -> Result<()> {
}, },
recv(signal_recvr) -> sig => { recv(signal_recvr) -> sig => {
match sig.unwrap() { match sig.unwrap() {
signal_hook::SIGWINCH => { signal_hook::consts::SIGWINCH => {
if state.mode != UIMode::Fork { if state.mode != UIMode::Fork {
state.update_size(); state.update_size();
state.render(); state.render();
state.redraw(); state.redraw();
} }
}, },
signal_hook::SIGCHLD => { signal_hook::consts::SIGCHLD => {
state.rcv_event(UIEvent::EmbedInput((Key::Null, vec![0]))); state.rcv_event(UIEvent::EmbedInput((Key::Null, vec![0])));
state.redraw(); state.redraw();

View File

@ -25,11 +25,9 @@
use crate::components::Component; use crate::components::Component;
pub use melib::thread::{SortField, SortOrder}; pub use melib::thread::{SortField, SortOrder};
use melib::uuid::Uuid;
use std::path::PathBuf; use std::path::PathBuf;
extern crate uuid;
use uuid::Uuid;
#[derive(Debug)] #[derive(Debug)]
pub enum TagAction { pub enum TagAction {
Add(String), Add(String),

View File

@ -2466,8 +2466,8 @@ impl Component for MailView {
if let Some(filename) = u.filename() { if let Some(filename) = u.filename() {
path.push(filename); path.push(filename);
} else { } else {
let u = Uuid::new_v4(); let u = melib::uuid::Uuid::new_v4();
path.push(u.to_hyphenated().to_string()); path.push(u.as_hyphenated().to_string());
} }
} }
match save_attachment(&path, &decode(u, None)) { match save_attachment(&path, &decode(u, None)) {

View File

@ -39,7 +39,7 @@ use std::collections::{HashMap, HashSet};
use crate::types::UIEvent::{self, EnvelopeRemove, EnvelopeRename, EnvelopeUpdate, Notification}; use crate::types::UIEvent::{self, EnvelopeRemove, EnvelopeRename, EnvelopeUpdate, Notification};
use crate::{StatusEvent, ThreadEvent}; use crate::{StatusEvent, ThreadEvent};
use crossbeam::Sender; use crossbeam::channel::Sender;
use futures::{ use futures::{
future::FutureExt, future::FutureExt,
stream::{Stream, StreamExt}, stream::{Stream, StreamExt},

View File

@ -26,24 +26,23 @@
//! let (channel, handle, job_id) = job_executor.spawn(job); //! let (channel, handle, job_id) = job_executor.spawn(job);
//! ``` //! ```
use melib::error::Result;
use melib::smol; use melib::smol;
use melib::uuid::Uuid;
use std::collections::HashMap; use std::collections::HashMap;
use std::future::Future; use std::future::Future;
use std::panic::catch_unwind; use std::panic::catch_unwind;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use uuid::Uuid;
use crate::types::{ThreadEvent, UIEvent}; use crate::types::{ThreadEvent, UIEvent};
use crossbeam::channel::Sender;
use crossbeam::deque::{Injector, Stealer, Worker}; use crossbeam::deque::{Injector, Stealer, Worker};
use crossbeam::sync::{Parker, Unparker}; use crossbeam::sync::{Parker, Unparker};
use crossbeam::Sender;
pub use futures::channel::oneshot; pub use futures::channel::oneshot;
use std::iter; use std::iter;
type AsyncTask = async_task::Task<()>; type AsyncTask = async_task::Runnable;
fn find_task<T>(local: &Worker<T>, global: &Injector<T>, stealers: &[Stealer<T>]) -> Option<T> { fn find_task<T>(local: &Worker<T>, global: &Injector<T>, stealers: &[Stealer<T>]) -> Option<T> {
// Pop a task from the local queue, if not empty. // Pop a task from the local queue, if not empty.
@ -117,7 +116,8 @@ struct TimerPrivate {
/// Time until next expiration. /// Time until next expiration.
value: Duration, value: Duration,
active: bool, active: bool,
handle: Option<async_task::JoinHandle<(), ()>>, handle: Option<async_task::Task<()>>,
cancel: Arc<Mutex<bool>>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -215,32 +215,36 @@ impl JobExecutor {
let finished_sender = self.sender.clone(); let finished_sender = self.sender.clone();
let job_id = JobId::new(); let job_id = JobId::new();
let injector = self.global_queue.clone(); let injector = self.global_queue.clone();
let cancel = Arc::new(Mutex::new(false));
let cancel2 = cancel.clone();
// Create a task and schedule it for execution. // Create a task and schedule it for execution.
let (task, handle) = async_task::spawn( let (handle, task) = async_task::spawn(
async move { async move {
let res = future.await; let res = future.await;
let _ = sender.send(res); let _ = sender.send(res);
finished_sender finished_sender
.send(ThreadEvent::JobFinished(job_id)) .send(ThreadEvent::JobFinished(job_id))
.unwrap(); .unwrap();
Ok(())
}, },
move |task| { move |task| {
if *cancel.lock().unwrap() {
return;
}
injector.push(MeliTask { injector.push(MeliTask {
task, task,
id: job_id, id: job_id,
timer: false, timer: false,
}) })
}, },
(),
); );
task.schedule(); handle.schedule();
for unparker in self.parkers.iter() { for unparker in self.parkers.iter() {
unparker.unpark(); unparker.unpark();
} }
JoinHandle { JoinHandle {
inner: handle, task: Arc::new(Mutex::new(Some(task))),
cancel: cancel2,
chan: receiver, chan: receiver,
job_id, job_id,
} }
@ -259,6 +263,7 @@ impl JobExecutor {
let id = Uuid::new_v4(); let id = Uuid::new_v4();
let timer = TimerPrivate { let timer = TimerPrivate {
interval, interval,
cancel: Arc::new(Mutex::new(false)),
value, value,
active: true, active: true,
handle: None, handle: None,
@ -274,9 +279,6 @@ impl JobExecutor {
pub fn rearm(&self, timer_id: Uuid) { pub fn rearm(&self, timer_id: Uuid) {
let mut timers_lck = self.timers.lock().unwrap(); let mut timers_lck = self.timers.lock().unwrap();
if let Some(timer) = timers_lck.get_mut(&timer_id) { if let Some(timer) = timers_lck.get_mut(&timer_id) {
if let Some(handle) = timer.handle.take() {
handle.cancel();
}
let value = timer.value; let value = timer.value;
drop(timers_lck); drop(timers_lck);
self.arm_timer(timer_id, value); self.arm_timer(timer_id, value);
@ -288,6 +290,8 @@ impl JobExecutor {
let sender = self.sender.clone(); let sender = self.sender.clone();
let injector = self.global_queue.clone(); let injector = self.global_queue.clone();
let timers = self.timers.clone(); let timers = self.timers.clone();
let cancel = Arc::new(Mutex::new(false));
let cancel2 = cancel.clone();
let (task, handle) = async_task::spawn( let (task, handle) = async_task::spawn(
async move { async move {
let mut value = value; let mut value = value;
@ -312,16 +316,19 @@ impl JobExecutor {
} }
}, },
move |task| { move |task| {
if *cancel.lock().unwrap() {
return;
}
injector.push(MeliTask { injector.push(MeliTask {
task, task,
id: job_id, id: job_id,
timer: true, timer: true,
}) })
}, },
(),
); );
self.timers.lock().unwrap().entry(id).and_modify(|timer| { self.timers.lock().unwrap().entry(id).and_modify(|timer| {
timer.handle = Some(handle); timer.handle = Some(handle);
timer.cancel = cancel2;
timer.active = true; timer.active = true;
}); });
task.schedule(); task.schedule();
@ -333,10 +340,8 @@ impl JobExecutor {
fn disable_timer(&self, id: Uuid) { fn disable_timer(&self, id: Uuid) {
let mut timers_lck = self.timers.lock().unwrap(); let mut timers_lck = self.timers.lock().unwrap();
if let Some(timer) = timers_lck.get_mut(&id) { if let Some(timer) = timers_lck.get_mut(&id) {
if let Some(handle) = timer.handle.take() {
handle.cancel();
}
timer.active = false; timer.active = false;
*timer.cancel.lock().unwrap() = true;
} }
} }
@ -353,14 +358,15 @@ pub type JobChannel<T> = oneshot::Receiver<T>;
#[derive(Debug)] #[derive(Debug)]
/// JoinHandle for the future that allows us to cancel the task. /// JoinHandle for the future that allows us to cancel the task.
pub struct JoinHandle<T> { pub struct JoinHandle<T> {
pub inner: async_task::JoinHandle<Result<()>, ()>, pub task: Arc<Mutex<Option<async_task::Task<()>>>>,
pub chan: JobChannel<T>, pub chan: JobChannel<T>,
pub cancel: Arc<Mutex<bool>>,
pub job_id: JobId, pub job_id: JobId,
} }
impl<T> JoinHandle<T> { impl<T> JoinHandle<T> {
pub fn cancel(&self) { pub fn cancel(&self) {
self.inner.cancel() *self.cancel.lock().unwrap() = true;
} }
} }

View File

@ -375,7 +375,7 @@ pub fn search(
.map_err(|e| MeliError::new(e.to_string()))?; .map_err(|e| MeliError::new(e.to_string()))?;
let results = stmt let results = stmt
.query_map(rusqlite::NO_PARAMS, |row| Ok(row.get(0)?)) .query_map([], |row| Ok(row.get(0)?))
.map_err(|e| MeliError::new(e.to_string()))? .map_err(|e| MeliError::new(e.to_string()))?
.map(|r: std::result::Result<Vec<u8>, rusqlite::Error>| { .map(|r: std::result::Result<Vec<u8>, rusqlite::Error>| {
Ok(u64::from_be_bytes( Ok(u64::from_be_bytes(

View File

@ -80,11 +80,11 @@ pub fn create_pty(
ws_ypixel: 0, ws_ypixel: 0,
}; };
let master_fd = master_fd.clone().into_raw_fd(); let master_fd = master_fd.as_raw_fd();
unsafe { set_window_size(master_fd, &winsize)? }; unsafe { set_window_size(master_fd, &winsize)? };
} }
let child_pid = match fork()? { let child_pid = match unsafe { fork()? } {
ForkResult::Child => { ForkResult::Child => {
/* Open slave end for pseudoterminal */ /* Open slave end for pseudoterminal */
let slave_fd = open(Path::new(&slave_name), OFlag::O_RDWR, stat::Mode::empty())?; let slave_fd = open(Path::new(&slave_name), OFlag::O_RDWR, stat::Mode::empty())?;
@ -152,7 +152,7 @@ pub fn create_pty(
ForkResult::Parent { child } => child, ForkResult::Parent { child } => child,
}; };
let stdin = unsafe { std::fs::File::from_raw_fd(master_fd.clone().into_raw_fd()) }; let stdin = unsafe { std::fs::File::from_raw_fd(master_fd.as_raw_fd()) };
let mut embed_grid = EmbedTerminal::new(stdin, child_pid); let mut embed_grid = EmbedTerminal::new(stdin, child_pid);
embed_grid.set_terminal_size((width, height)); embed_grid.set_terminal_size((width, height));
let grid = Arc::new(Mutex::new(embed_grid)); let grid = Arc::new(Mutex::new(embed_grid));

View File

@ -42,10 +42,10 @@ use crate::components::{Component, ComponentId, ScrollUpdate};
use std::sync::Arc; use std::sync::Arc;
use melib::backends::{AccountHash, BackendEvent, MailboxHash}; use melib::backends::{AccountHash, BackendEvent, MailboxHash};
use melib::uuid::Uuid;
use melib::{EnvelopeHash, RefreshEvent, ThreadHash}; use melib::{EnvelopeHash, RefreshEvent, ThreadHash};
use nix::unistd::Pid; use nix::unistd::Pid;
use std::fmt; use std::fmt;
use uuid::Uuid;
#[derive(Debug)] #[derive(Debug)]
pub enum StatusEvent { pub enum StatusEvent {

View File

@ -25,7 +25,7 @@ use std::io::{Read, Write};
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use std::path::PathBuf; use std::path::PathBuf;
use uuid::Uuid; use melib::uuid::Uuid;
#[derive(Debug)] #[derive(Debug)]
pub struct File { pub struct File {
@ -84,7 +84,7 @@ pub fn create_temp_file(
dir.push(filename) dir.push(filename)
} else { } else {
let u = Uuid::new_v4(); let u = Uuid::new_v4();
dir.push(u.to_hyphenated().to_string()); dir.push(u.as_hyphenated().to_string());
} }
&dir &dir
}); });