Merge branch 'dev' of github.com:federico-terzi/espanso into dev
This commit is contained in:
commit
2d44c51dad
|
@ -745,7 +745,7 @@ int32_t start_daemon_process() {
|
|||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
DETACHED_PROCESS,
|
||||
DETACHED_PROCESS | CREATE_NO_WINDOW,
|
||||
NULL,
|
||||
NULL,
|
||||
&si,
|
||||
|
|
|
@ -133,7 +133,7 @@ def build_windows(package_info):
|
|||
include_list.append("Source: \""+dll+"\"; DestDir: \"{app}\"; Flags: ignoreversion")
|
||||
|
||||
print("Including modulo")
|
||||
include_list.append("Source: \""+modulo_target_file+"\"; DestDir: \"{app}\"; Flags: ignoreversion")
|
||||
include_list.append("Source: \""+os.path.abspath(modulo_target_file)+"\"; DestDir: \"{app}\"; Flags: ignoreversion")
|
||||
|
||||
include = "\r\n".join(include_list)
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ impl super::Extension for ScriptExtension {
|
|||
let mut command = Command::new(&str_args[0]);
|
||||
|
||||
// Set the OS-specific flags
|
||||
super::utils::set_command_flags(&mut command);
|
||||
crate::utils::set_command_flags(&mut command);
|
||||
|
||||
// Inject the $CONFIG variable
|
||||
command.env("CONFIG", crate::context::get_config_dir());
|
||||
|
|
|
@ -81,7 +81,7 @@ impl Shell {
|
|||
};
|
||||
|
||||
// Set the OS-specific flags
|
||||
super::utils::set_command_flags(&mut command);
|
||||
crate::utils::set_command_flags(&mut command);
|
||||
|
||||
// Inject the $CONFIG variable
|
||||
command.env("CONFIG", crate::context::get_config_dir());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::extension::ExtensionResult;
|
||||
use std::collections::HashMap;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn convert_to_env_variables(
|
||||
original_vars: &HashMap<String, ExtensionResult>,
|
||||
|
@ -25,19 +24,6 @@ pub fn convert_to_env_variables(
|
|||
output
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn set_command_flags(command: &mut Command) {
|
||||
use std::os::windows::process::CommandExt;
|
||||
// Avoid showing the shell window
|
||||
// See: https://github.com/federico-terzi/espanso/issues/249
|
||||
command.creation_flags(0x08000000);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub fn set_command_flags(command: &mut Command) {
|
||||
// NOOP on Linux and macOS
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::process::{Child, Command, Stdio};
|
|||
pub fn spawn_process(cmd: &str, args: &Vec<String>) -> io::Result<Child> {
|
||||
use std::os::windows::process::CommandExt;
|
||||
Command::new(cmd)
|
||||
.creation_flags(0x00000008) // Detached Process
|
||||
.creation_flags(0x08000008) // Detached Process without window
|
||||
.args(args)
|
||||
.spawn()
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -3,8 +3,6 @@ use log::{error, info};
|
|||
use std::io::{Error, Write};
|
||||
use std::process::{Child, Command, Output};
|
||||
|
||||
pub mod form;
|
||||
|
||||
pub struct ModuloManager {
|
||||
modulo_path: Option<String>,
|
||||
}
|
||||
|
@ -72,12 +70,15 @@ impl ModuloManager {
|
|||
}
|
||||
|
||||
if let Some(ref modulo_path) = self.modulo_path {
|
||||
let child = Command::new(modulo_path)
|
||||
.args(args)
|
||||
let mut command = Command::new(modulo_path);
|
||||
command.args(args)
|
||||
.stdin(std::process::Stdio::piped())
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
.spawn();
|
||||
.stderr(std::process::Stdio::piped());
|
||||
|
||||
crate::utils::set_command_flags(&mut command);
|
||||
|
||||
let child = command.spawn();
|
||||
|
||||
match child {
|
||||
Ok(mut child) => {
|
||||
|
|
14
src/utils.rs
14
src/utils.rs
|
@ -20,6 +20,7 @@
|
|||
use std::error::Error;
|
||||
use std::fs::create_dir;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn copy_dir(source_dir: &Path, dest_dir: &Path) -> Result<(), Box<dyn Error>> {
|
||||
for entry in std::fs::read_dir(source_dir)? {
|
||||
|
@ -40,6 +41,19 @@ pub fn copy_dir(source_dir: &Path, dest_dir: &Path) -> Result<(), Box<dyn Error>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn set_command_flags(command: &mut Command) {
|
||||
use std::os::windows::process::CommandExt;
|
||||
// Avoid showing the shell window
|
||||
// See: https://github.com/federico-terzi/espanso/issues/249
|
||||
command.creation_flags(0x08000000);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub fn set_command_flags(command: &mut Command) {
|
||||
// NOOP on Linux and macOS
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in New Issue
Block a user