Skip to content

[bug] Command::output() never executes/completes in async commands #3505

@FabianLars

Description

@FabianLars

Describe the bug

If you try to execute a sidecar or Commands in general in an async command it never drives to completion (or probably doesn't even start in the first place).

I tested this only on windows, but according to discord it's a problem on linux or macOS too (can't remember which one they had)

Reproduction

Create a simple async command (I'm using windows for this example):

#[tauri::command]
async fn list_dir() {
    let c = Command::new("powershell.exe").args(["ls"]);
    dbg!(c.output().unwrap());
}

It works if you remove the async keyword. Same if you use (the underlying) std::process::Command::output().
Command::spawn() works fine fwiw.

Expected behavior

No response

Platform and versions

Operating System - Windows, version 10.0.19044 X64
Webview2 - 98.0.1108.55
Visual Studio Build Tools:
   - Visual Studio Build Tools 2022

Node.js environment
  Node.js - 16.14.0
  @tauri-apps/cli - 1.0.0-rc.5
  @tauri-apps/api - 1.0.0-rc.1

Global packages
  npm - 8.3.1
  pnpm - 6.31.0
  yarn - Not installed

Rust environment
  rustup - 1.24.3
  rustc - 1.58.1
  cargo - 1.58.0
  toolchain - stable-x86_64-pc-windows-msvc 

App directory structure
/dist
/node_modules
/src
/src-tauri

App
  tauri - 1.0.0-rc.3 (no lockfile)
  tauri-build - no manifest (no lockfile)
  tao - no manifest (no lockfile)
  wry - no manifest (no lockfile)
  build-type - bundle
  CSP - default-src 'self'
  distDir - ../dist
  devPath - http://localhost:3000/
  framework - React

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions