fix(scripts): Close signal was not being sent
This commit is contained in:
parent
dbcf28b3d8
commit
3be27dde0d
1 changed files with 10 additions and 17 deletions
|
|
@ -4,12 +4,12 @@ use pop_launcher::*;
|
||||||
use futures_lite::{AsyncBufReadExt, StreamExt};
|
use futures_lite::{AsyncBufReadExt, StreamExt};
|
||||||
use postage::mpsc::Sender;
|
use postage::mpsc::Sender;
|
||||||
use postage::prelude::*;
|
use postage::prelude::*;
|
||||||
|
use smol::process::{Command, Stdio};
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
use std::{
|
use std::{
|
||||||
io,
|
io,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{Command, Stdio},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const LOCAL_PATH: &str = ".local/share/pop-launcher/scripts";
|
const LOCAL_PATH: &str = ".local/share/pop-launcher/scripts";
|
||||||
|
|
@ -53,24 +53,17 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn activate(&mut self, id: u32) {
|
async fn activate(&mut self, id: u32) {
|
||||||
use fork::{daemon, Fork};
|
if let Some(script) = self.scripts.get(id as usize) {
|
||||||
|
let interpreter = script.interpreter.as_deref().unwrap_or("sh");
|
||||||
|
send(&mut self.out, PluginResponse::Close).await;
|
||||||
|
|
||||||
if let Ok(Fork::Child) = daemon(true, true) {
|
let _ = Command::new(interpreter)
|
||||||
if let Some(script) = self.scripts.get(id as usize) {
|
.arg(script.path.as_os_str())
|
||||||
let interpreter = script.interpreter.as_deref().unwrap_or("sh");
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
let why = dbg!(Command::new(interpreter).arg(script.path.as_os_str()))
|
.stderr(Stdio::null())
|
||||||
.stdin(Stdio::null())
|
.spawn();
|
||||||
.stdout(Stdio::null())
|
|
||||||
.stderr(Stdio::null())
|
|
||||||
.exec();
|
|
||||||
|
|
||||||
tracing::error!("failed to exec: {}", why);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
send(&mut self.out, PluginResponse::Close).await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn reload(&mut self) {
|
async fn reload(&mut self) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue