tauri-apps / tauri-apps/plugins-workspace

[shell] JavaScript errors thrown by stdout/stderr handlers fail silently

Open
#3,461 0 comments 0 reactions 0 assignees View on GitHub
plugin: shell type: bug type: feature request
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

### Describe the bug

It seems that the JavaScript errors thrown by a handler of the `data` event emitted by the `stdout`/`stderr` event emitters of a `Command` object are silenced for some reason, meaning they don't appear anywhere in the DevTools console. In addition they also prevent further reading of the pipe, while the process seems to run just fine.

This obviously makes it very hard to debug and while it can be fixed by enclosing the handlers in a try/catch block that reports to the console, it's unintuitive and if unknown, it can be a hard thing to pinpoint while debugging a handler function that seems to just stop working.

### Reproduction

```ts
import { Command } from "@tauri-apps/plugin-shell";

const cmd = Command.create("ls"); // Set to a random command
cmd.stdout.on("data", (line) => {
console.log({ line });
throw new Error();
console.log("end");
});
await cmd.spawn();
```

The result will be a single line printed in the DevTools console, after which no other lines will be printed, even if no exception is thrown by their respective handler.

### Expected behavior

When a `stdout`/`stderr` listener throws, it should at least print a warning in the console instead of just stopping to function.

### Full `tauri info` output

```text
[✔] Environment
- OS: Windows 10.0.26200 x86_64 (X64)
✔ WebView2: 149.0.4022.80
✔ MSVC: Visual Studio Community 2026
✔ rustc: 1.95.0 (59807616e 2026-04-14)
✔ cargo: 1.95.0 (f2d3ce0bd 2026-03-21)
✔ rustup: 1.29.0 (28d1352db 2026-03-05)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 22.14.0
- pnpm: 11.4.0
- npm: 11.15.0
- bun: 1.3.14

[-] Packages
- tauri 🦀: 2.11.2, (outdated, latest: 2.11.3)
- tauri-build 🦀: 2.6.2, (outdated, latest: 2.6.3)
- wry 🦀: 0.55.1
- tao 🦀: 0.35.2, (outdated, latest: 0.35.3)
- @tauri-apps/api ⱼₛ: 2.11.0 (outdated, latest: 2.11.1)
- @tauri-apps/cli ⱼₛ: 2.11.2 (outdated, latest: 2.11.3)

[-] Plugins
- tauri-plugin-shell 🦀: 2.3.5
- @tauri-apps/plugin-shell ⱼₛ: 2.3.5
- tauri-plugin-opener 🦀: 2.5.4
- @tauri-apps/plugin-opener ⱼₛ: 2.5.4
- tauri-plugin-os 🦀: 2.3.2
- @tauri-apps/plugin-os ⱼₛ: 2.3.2
- tauri-plugin-dialog 🦀: 2.7.1
- @tauri-apps/plugin-dialog ⱼₛ: 2.7.1
- tauri-plugin-clipboard-manager 🦀: 2.3.2
- @tauri-apps/plugin-clipboard-manager ⱼₛ: 2.3.2
- tauri-plugin-fs 🦀: 2.5.1
- @tauri-apps/plugin-fs ⱼₛ: 2.5.1

[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../build
- devUrl: http://localhost:1420/
- framework: Svelte
- bundler: Vite
```

### Stack trace

```text

```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the plugin-shell implementation of the Command stdout/stderr data events and reproduce the behavior with the TypeScript example in the issue. Trace how listener exceptions are handled and verify that thrown errors become visible in the DevTools console without stopping subsequent pipe reads.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust, typescript
Domain
api, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.