Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): fix compilation when shell-execute or shell-sidecar #9729

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/shell-execute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": "patch:bug"
---

Fix compilation error when `shell-execute` or `shell-sidecar` features are not active
6 changes: 4 additions & 2 deletions core/tauri/src/endpoints/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ impl Cmd {
let encoding = options
.encoding
.as_ref()
.and_then(|encoding| crate::api::process::Encoding::for_label(encoding.as_bytes()));
.and_then(|encoding| encoding_rs::Encoding::for_label(encoding.as_bytes()));

let command = prepare_cmd(&context, &program, args, options)?;

let mut command: std::process::Command = command.into();
Expand Down Expand Up @@ -222,6 +223,7 @@ impl Cmd {
}
}

#[cfg(any(shell_execute, shell_sidecar))]
fn prepare_cmd<R: Runtime>(
context: &InvokeContext<R>,
program: &String,
Expand Down Expand Up @@ -287,7 +289,7 @@ fn prepare_cmd<R: Runtime>(
command = command.env_clear();
}
if let Some(encoding) = &options.encoding {
if let Some(encoding) = crate::api::process::Encoding::for_label(encoding.as_bytes()) {
if let Some(encoding) = encoding_rs::Encoding::for_label(encoding.as_bytes()) {
command = command.encoding(encoding);
} else {
return Err(anyhow::anyhow!(format!("unknown encoding {encoding}")));
Expand Down
Loading