mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
helper: adjust portable_pty
new `portable_pty` from `cargo upgrade` has a new API on getting STDIN.
This commit is contained in:
parent
65d1cd4115
commit
9b757d1db9
3 changed files with 6 additions and 5 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2049,7 +2049,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gupax"
|
||||
version = "1.2.2"
|
||||
version = "1.2.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arti-client",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "gupax"
|
||||
version = "1.2.2"
|
||||
version = "1.2.3"
|
||||
authors = ["hinto-janai <hinto.janai@protonmail.com>"]
|
||||
description = "GUI for P2Pool+XMRig"
|
||||
documentation = "https://github.com/hinto-janai/gupax"
|
||||
|
|
|
@ -504,7 +504,7 @@ impl Helper {
|
|||
lock.signal = ProcessSignal::None;
|
||||
lock.start = Instant::now();
|
||||
let reader = pair.master.try_clone_reader().unwrap(); // Get STDOUT/STDERR before moving the PTY
|
||||
let mut stdin = pair.master;
|
||||
let mut stdin = pair.master.take_writer().unwrap();
|
||||
drop(lock);
|
||||
|
||||
// 3. Spawn PTY read thread
|
||||
|
@ -896,13 +896,15 @@ impl Helper {
|
|||
let child_pty = arc_mut!(pair.slave.spawn_command(cmd).unwrap());
|
||||
drop(pair.slave);
|
||||
|
||||
let mut stdin = pair.master.take_writer().unwrap();
|
||||
|
||||
// 2. Input [sudo] pass, wipe, then drop.
|
||||
if cfg!(unix) {
|
||||
debug!("XMRig | Inputting [sudo] and wiping...");
|
||||
// a) Sleep to wait for [sudo]'s non-echo prompt (on Unix).
|
||||
// this prevents users pass from showing up in the STDOUT.
|
||||
sleep!(3000);
|
||||
if let Err(e) = writeln!(pair.master, "{}", lock!(sudo).pass) { error!("XMRig | Sudo STDIN error: {}", e); };
|
||||
if let Err(e) = writeln!(stdin, "{}", lock!(sudo).pass) { error!("XMRig | Sudo STDIN error: {}", e); };
|
||||
SudoState::wipe(&sudo);
|
||||
|
||||
// b) Reset GUI STDOUT just in case.
|
||||
|
@ -918,7 +920,6 @@ impl Helper {
|
|||
lock.signal = ProcessSignal::None;
|
||||
lock.start = Instant::now();
|
||||
let reader = pair.master.try_clone_reader().unwrap(); // Get STDOUT/STDERR before moving the PTY
|
||||
let mut stdin = pair.master;
|
||||
drop(lock);
|
||||
|
||||
// 4. Spawn PTY read thread
|
||||
|
|
Loading…
Reference in a new issue