mirror of
https://github.com/hinto-janai/gupax.git
synced 2025-03-21 06:38:45 +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]]
|
[[package]]
|
||||||
name = "gupax"
|
name = "gupax"
|
||||||
version = "1.2.2"
|
version = "1.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arti-client",
|
"arti-client",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gupax"
|
name = "gupax"
|
||||||
version = "1.2.2"
|
version = "1.2.3"
|
||||||
authors = ["hinto-janai <hinto.janai@protonmail.com>"]
|
authors = ["hinto-janai <hinto.janai@protonmail.com>"]
|
||||||
description = "GUI for P2Pool+XMRig"
|
description = "GUI for P2Pool+XMRig"
|
||||||
documentation = "https://github.com/hinto-janai/gupax"
|
documentation = "https://github.com/hinto-janai/gupax"
|
||||||
|
|
|
@ -504,7 +504,7 @@ impl Helper {
|
||||||
lock.signal = ProcessSignal::None;
|
lock.signal = ProcessSignal::None;
|
||||||
lock.start = Instant::now();
|
lock.start = Instant::now();
|
||||||
let reader = pair.master.try_clone_reader().unwrap(); // Get STDOUT/STDERR before moving the PTY
|
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);
|
drop(lock);
|
||||||
|
|
||||||
// 3. Spawn PTY read thread
|
// 3. Spawn PTY read thread
|
||||||
|
@ -896,13 +896,15 @@ impl Helper {
|
||||||
let child_pty = arc_mut!(pair.slave.spawn_command(cmd).unwrap());
|
let child_pty = arc_mut!(pair.slave.spawn_command(cmd).unwrap());
|
||||||
drop(pair.slave);
|
drop(pair.slave);
|
||||||
|
|
||||||
|
let mut stdin = pair.master.take_writer().unwrap();
|
||||||
|
|
||||||
// 2. Input [sudo] pass, wipe, then drop.
|
// 2. Input [sudo] pass, wipe, then drop.
|
||||||
if cfg!(unix) {
|
if cfg!(unix) {
|
||||||
debug!("XMRig | Inputting [sudo] and wiping...");
|
debug!("XMRig | Inputting [sudo] and wiping...");
|
||||||
// a) Sleep to wait for [sudo]'s non-echo prompt (on Unix).
|
// a) Sleep to wait for [sudo]'s non-echo prompt (on Unix).
|
||||||
// this prevents users pass from showing up in the STDOUT.
|
// this prevents users pass from showing up in the STDOUT.
|
||||||
sleep!(3000);
|
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);
|
SudoState::wipe(&sudo);
|
||||||
|
|
||||||
// b) Reset GUI STDOUT just in case.
|
// b) Reset GUI STDOUT just in case.
|
||||||
|
@ -918,7 +920,6 @@ impl Helper {
|
||||||
lock.signal = ProcessSignal::None;
|
lock.signal = ProcessSignal::None;
|
||||||
lock.start = Instant::now();
|
lock.start = Instant::now();
|
||||||
let reader = pair.master.try_clone_reader().unwrap(); // Get STDOUT/STDERR before moving the PTY
|
let reader = pair.master.try_clone_reader().unwrap(); // Get STDOUT/STDERR before moving the PTY
|
||||||
let mut stdin = pair.master;
|
|
||||||
drop(lock);
|
drop(lock);
|
||||||
|
|
||||||
// 4. Spawn PTY read thread
|
// 4. Spawn PTY read thread
|
||||||
|
|
Loading…
Reference in a new issue