Skip to content

Commit

Permalink
fix(core): compilation issues without execute or sidecar features (#6621
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lucasfernog authored Apr 3, 2023
1 parent 09d5dd5 commit a813792
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-shell-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Fix compilation issues without the shell API features.
14 changes: 7 additions & 7 deletions core/tauri/src/endpoints/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
#![allow(unused_imports)]

use super::InvokeContext;
use crate::{
api::{
ipc::CallbackFn,
process::{CommandEvent, TerminatedPayload},
},
Runtime,
};
#[cfg(any(shell_execute, shell_sidecar))]
use crate::api::process::{CommandEvent, TerminatedPayload};
use crate::{api::ipc::CallbackFn, Runtime};
#[cfg(shell_scope)]
use crate::{Manager, Scopes};
use encoding_rs::Encoding;
Expand All @@ -38,6 +34,7 @@ fn command_child_store() -> &'static ChildStore {
&STORE
}

#[cfg(any(shell_execute, shell_sidecar))]
#[derive(Debug, Clone, Serialize)]
#[serde(tag = "event", content = "payload")]
#[non_exhaustive]
Expand All @@ -52,6 +49,7 @@ enum JSCommandEvent {
Terminated(TerminatedPayload),
}

#[cfg(any(shell_execute, shell_sidecar))]
fn get_event_buffer(line: Vec<u8>, encoding: EncodingWrapper) -> Result<Buffer, FromUtf8Error> {
match encoding {
EncodingWrapper::Text(character_encoding) => match character_encoding {
Expand All @@ -64,6 +62,7 @@ fn get_event_buffer(line: Vec<u8>, encoding: EncodingWrapper) -> Result<Buffer,
}
}

#[cfg(any(shell_execute, shell_sidecar))]
impl JSCommandEvent {
pub fn new(event: CommandEvent, encoding: EncodingWrapper) -> Self {
match event {
Expand All @@ -87,6 +86,7 @@ pub enum Buffer {
Raw(Vec<u8>),
}

#[cfg(any(shell_execute, shell_sidecar))]
#[derive(Debug, Copy, Clone)]
pub enum EncodingWrapper {
Raw,
Expand Down

0 comments on commit a813792

Please sign in to comment.