Revert "su: allocate new pty (#1693)"

This reverts commit 935dc18faa.
This commit is contained in:
weishu
2024-05-08 21:17:24 +08:00
parent 98757bcdb3
commit a3df721b84
7 changed files with 2 additions and 236 deletions

View File

@@ -11,8 +11,6 @@ use crate::{
utils::{self, umask},
};
#[cfg(any(target_os = "linux", target_os = "android"))]
use crate::pty::prepare_pty;
#[cfg(any(target_os = "linux", target_os = "android"))]
use rustix::{
process::getuid,
@@ -140,7 +138,6 @@ pub fn root_shell() -> Result<()> {
"Specify a supplementary group. The first specified supplementary group is also used as a primary group if the option -g is not specified.",
"GROUP",
);
opts.optflag("", "no-pty", "Do not allocate a new pseudo terminal.");
// Replace -cn with -z, -mm with -M for supporting getopt_long
let args = args
@@ -268,13 +265,6 @@ pub fn root_shell() -> Result<()> {
command = command.env("ENV", defs::KSURC_PATH);
}
#[cfg(target_os = "android")]
if !matches.opt_present("no-pty") {
if let Err(e) = prepare_pty() {
log::error!("failed to prepare pty: {:?}", e);
}
}
// escape from the current cgroup and become session leader
// WARNING!!! This cause some root shell hang forever!
// command = command.process_group(0);