fix(terminal): Do not invoke read command on shell execution
This commit is contained in:
parent
3b4136eeef
commit
74d1bdfce5
1 changed files with 12 additions and 6 deletions
|
|
@ -44,8 +44,8 @@ pub async fn main() {
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
async fn activate(&mut self, _id: u32) {
|
async fn activate(&mut self, _id: u32) {
|
||||||
let exec = match self.last_query.take() {
|
let exe = match self.last_query.take() {
|
||||||
Some(cmd) => format!("{}; echo \"Press Enter to exit\"; read t", cmd),
|
Some(cmd) => cmd,
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ impl App {
|
||||||
|
|
||||||
crate::send(&mut self.out, PluginResponse::Close).await;
|
crate::send(&mut self.out, PluginResponse::Close).await;
|
||||||
|
|
||||||
if let Ok(Fork::Child) = daemon(true, true) {
|
if let Ok(Fork::Child) = daemon(true, false) {
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
|
|
@ -61,16 +61,22 @@ impl App {
|
||||||
|
|
||||||
if self.shell_only {
|
if self.shell_only {
|
||||||
cmd = Command::new("sh");
|
cmd = Command::new("sh");
|
||||||
cmd.args(&["-c", &exec]);
|
cmd.args(&["-c", &exe]);
|
||||||
} else {
|
} else {
|
||||||
let (terminal, arg) = detect_terminal();
|
let (terminal, arg) = detect_terminal();
|
||||||
cmd = Command::new(terminal);
|
cmd = Command::new(terminal);
|
||||||
cmd.args(&[arg, "sh", "-c", &exec]);
|
cmd.args(&[
|
||||||
|
arg,
|
||||||
|
"sh",
|
||||||
|
"-c",
|
||||||
|
&format!("{}; echo \"Press Enter to exit\"; read t", exe),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = cmd.exec();
|
let _ = cmd.exec();
|
||||||
std::process::exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn search(&mut self, query: String) {
|
async fn search(&mut self, query: String) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue