Make absolutely sure subprocess is not killed #14
3 changed files with 8 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
|||
use std::env;
|
||||
use std::io;
|
||||
use std::process;
|
||||
use serde_json::{self, json};
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use crate::browser;
|
||||
use crate::config::Config;
|
||||
|
@ -94,7 +95,7 @@ impl Command {
|
|||
// NOTE: On Windows, browser spawns process into a Job object.
|
||||
// NOTE: We need to detach player from the job, so it won't get killed after we're done,
|
||||
// NOTE: See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging#closing_the_native_app
|
||||
#[cfg(target_family = "windows")]
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
const CREATE_BREAKAWAY_FROM_JOB: u32 = 0x01000000;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::error::FF2MpvError;
|
||||
|
@ -16,7 +17,7 @@ impl Default for Config {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
player_command: "mpv".to_owned(),
|
||||
player_args: vec![]
|
||||
player_args: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +41,7 @@ impl Config {
|
|||
Ok(config)
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(unix)]
|
||||
fn get_config_location() -> PathBuf {
|
||||
let mut path = PathBuf::new();
|
||||
|
||||
|
@ -57,7 +58,7 @@ impl Config {
|
|||
path
|
||||
}
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
#[cfg(windows)]
|
||||
fn get_config_location() -> PathBuf {
|
||||
let mut path = PathBuf::new();
|
||||
let appdata = env::var("APPDATA").unwrap();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::io;
|
||||
use std::fmt;
|
||||
use std::fmt::Display;
|
||||
use std::io;
|
||||
|
||||
pub enum FF2MpvError {
|
||||
NoConfig,
|
||||
|
|
Loading…
Reference in a new issue