How do I use plugin-shell? #12293
Answered
by
FabianLars
Robert-Du0001
asked this question in
Q&A
-
I only know a bit of Rust. And I tried to use plugin-shell but encountered an error.: This is the code from use tauri_plugin_shell::ShellExt;
pub fn start_server(app_handle: tauri::AppHandle) {
let shell = app_handle.shell();
tauri::async_runtime::block_on(async move {
shell
.command("echo")
.args(["Hello"])
.output()
.await
.unwrap()
});
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_shell::init())
.setup(|app| {
start_server(app.handle().clone());
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
} Please, could someone tell me how to resolve this problem? |
Beta Was this translation helpful? Give feedback.
Answered by
FabianLars
Jan 7, 2025
Replies: 1 comment 1 reply
-
On windows |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Robert-Du0001
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On windows
echo
is not an executable so it cannot be used as a command like this. you'll have to usecmd.exe
orpowershell.exe
as the command andecho
as an argument.