new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Develop · all subjects

external binaries & sidecars

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Migrate Shell plugin: Rust open URL

Replace `tauri::api::shell` with `tauri-plugin-shell = "2"`. Add to Cargo.toml and initialize with `.plugin(tauri_plugin_shell::init())`. To open a URL: `app.shell().open("https://url", None)?` using the `ShellExt` trait.

Migrate Shell plugin: Rust spawn process and get status

Using `tauri-plugin-shell`, spawn a child process and get status code: `let status = tauri::async_runtime::block_on(async move { app.shell().command("which").args(["ls"]).status().await.unwrap() }); println!("{:?}", status.code());`

Migrate Shell plugin: Rust capture output

Using `tauri-plugin-shell`, create a child process and capture output: `let output = tauri::async_runtime::block_on(async move { app.shell().command("echo").args(["TAURI"]).output().await.unwrap() }); assert!(output.status.success()); assert_eq!(String::from_utf8(output.stdout).unwrap(), "TAURI");`

Migrate Shell plugin: Rust read async events

Using `tauri-plugin-shell`, spawn a process and read events asynchronously: `let (mut rx, mut child) = handle.shell().command("cargo").args(["tauri", "dev"]).spawn()?; while let Some(event) = rx.recv().await { if let CommandEvent::Stdout(line) = event { ... } }`

Migrate Shell plugin: JavaScript setup

Add `@tauri-apps/plugin-shell` to package.json. Initialize in Rust with `tauri_plugin_shell::init()`. Use JavaScript: `import { Command, open } from '@tauri-apps/plugin-shell'` and call `const output = await Command.create('echo', 'message').execute()` or `await open('https://github.com')`.

Migrate embedded resources: use filesystem plugin

For embedded resources in JavaScript, migrate to use the filesystem plugin. For Rust, migrate to use `tauri::Manager::path` for path resolution.

Migrate external binaries: sidecars use new permissions system

In Tauri v1, external binaries and arguments were defined in allowlists. In v2, use the new permissions system. JavaScript should use the shell plugin, and Rust should use `tauri_plugin_shell::ShellExt` with `tauri_plugin_shell::process::CommandEvent`. The `process-command-api` feature flag is removed; external binaries no longer require this feature to be defined.

Tauri v2: Shell plugin migration example

To migrate Shell functionality, add tauri-plugin-shell version 2 to Cargo.toml, initialize with tauri::Builder::default().plugin(tauri_plugin_shell::init()), add @tauri-apps/plugin-shell to package.json. Use Command.create() and Command.execute() in JavaScript or app.shell().command() in Rust. Use ShellExt trait to access shell functionality.

Tauri v2: Shell command execution examples

Shell plugin provides multiple command execution patterns: (1) Get status code: app.shell().command("which").args(["ls"]).status().await; (2) Capture output: app.shell().command("echo").args(["TAURI"]).output().await; (3) Async event reading: handle.shell().command("cargo").args(["tauri", "dev"]).spawn() returns (rx, child) for event handling.

Tauri v2: sidecar external binary migration

External binary execution migrated: v1 allowed via process-command-api feature in config (no longer needed); v2 uses shell plugin; JavaScript uses tauri-plugin-shell Command API; Rust uses tauri_plugin_shell::ShellExt with CommandEvent handling. The process-command-api feature flag removed entirely.

Give your agent this brain