Sfoglia il codice sorgente

fix(core): feature flag usage on the shell APIs

Lucas Nogueira 3 anni fa
parent
commit
a434393413
2 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 4 4
      core/tauri/src/endpoints/shell.rs
  2. 2 2
      core/tauri/src/scope/shell.rs

+ 4 - 4
core/tauri/src/endpoints/shell.rs

@@ -4,7 +4,7 @@
 
 use super::InvokeContext;
 use crate::{api::ipc::CallbackFn, Runtime};
-#[cfg(shell_execute)]
+#[cfg(shell_scope)]
 use crate::{Manager, Scopes};
 use serde::Deserialize;
 use tauri_macros::{module_command_handler, CommandModule};
@@ -14,15 +14,15 @@ use crate::ExecuteArgs;
 #[cfg(not(shell_scope))]
 type ExecuteArgs = ();
 
-#[cfg(shell_execute)]
+#[cfg(any(shell_execute, shell_sidecar))]
 use std::sync::{Arc, Mutex};
 use std::{collections::HashMap, path::PathBuf};
 
 type ChildId = u32;
-#[cfg(shell_execute)]
+#[cfg(any(shell_execute, shell_sidecar))]
 type ChildStore = Arc<Mutex<HashMap<ChildId, crate::api::process::CommandChild>>>;
 
-#[cfg(shell_execute)]
+#[cfg(any(shell_execute, shell_sidecar))]
 fn command_childs() -> &'static ChildStore {
   use once_cell::sync::Lazy;
   static STORE: Lazy<ChildStore> = Lazy::new(Default::default);

+ 2 - 2
core/tauri/src/scope/shell.rs

@@ -166,7 +166,7 @@ pub enum ScopeError {
   MissingVar(String),
 
   /// At least one argument did not pass input validation.
-  #[cfg(any(shell_execute, shell_open))]
+  #[cfg(shell_scope)]
   #[cfg_attr(
     doc_cfg,
     doc(cfg(any(feature = "shell-execute", feature = "shell-open")))
@@ -193,7 +193,7 @@ pub enum ScopeError {
   InvalidInput(String),
 
   /// A generic IO error that occurs while executing specified shell commands.
-  #[cfg(any(shell_execute, shell_sidecar))]
+  #[cfg(shell_scope)]
   #[cfg_attr(
     doc_cfg,
     doc(cfg(any(feature = "shell-execute", feature = "shell-sidecar")))