Skip to content
New issue

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

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

Already on GitHub? # to your account

[bug] Tauri 1.7.x breaks Command stdout/stderr #10651

Closed
leonbeon opened this issue Aug 16, 2024 · 1 comment
Closed

[bug] Tauri 1.7.x breaks Command stdout/stderr #10651

leonbeon opened this issue Aug 16, 2024 · 1 comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@leonbeon
Copy link

Describe the bug

Using Tauri v1.7.1 (and 1.7.0), my Command.execute() call does not return any events. Consider this example:

async function ytDlpCommand(args) {
	let cmd = new Command('yt-dlp', args);

	cmd.on('error', error => console.error(`command error: "${error}"`));
	cmd.on('close', line => console.log(`command close: "${line}"`));
	cmd.stdout.on('data', line => console.log(`command stdout: "${line}"`));
	cmd.stderr.on('data', line => console.log(`command stderr: "${line}"`));

	let output = await cmd.execute();
	return output;
}

which is basically the example code from the docs. I get no console output from any of the events. Did the syntax for events change? I couldn't find anything regarding api changes, only "speed up" changes in the v1.7.0 changelog.

Downgrading to Tauri v1.6.8, but keeping @tauri-apps/api at v1.6.0, I run into the error described in #9786. Downgrading @tauri-apps/api to v1.5.6 restores the functionality. This configuration works as I would expect:

[-] Packages
    - tauri [RUST]: 1.6.8
    - tauri-build [RUST]: 1.5.3
    - wry [RUST]: 0.24.10
    - tao [RUST]: 0.16.9
    - @tauri-apps/api [NPM]: 1.5.6 (outdated, latest: 1.6.0)
    - @tauri-apps/cli [NPM]: 1.4.0 (outdated, latest: 1.6.0)

Reproduction

No response

Expected behavior

See function above, basically any Command.execute() call with event listeners should reproduce this.

Full tauri info output

[✔] Environment
    - OS: Mac OS 13.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.72.0 (5680fa18f 2023-08-23)
    ✔ Cargo: 1.72.0 (103a7ff2e 2023-08-15)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 21.1.0
    - npm: 10.2.0

[-] Packages
    - tauri [RUST]: 1.7.1
    - tauri-build [RUST]: 1.5.3
    - wry [RUST]: 0.24.10
    - tao [RUST]: 0.16.9
    - @tauri-apps/api [NPM]: 1.6.0
    - @tauri-apps/cli [NPM]: 1.4.0 (outdated, latest: 1.6.0)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../build
    - devPath: http://localhost:5173/
    - framework: Svelte
    - bundler: Vite

Stack trace

No response

Additional context

No response

@leonbeon leonbeon added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 16, 2024
@amrbashir
Copy link
Member

Looking at the example, you're using .execute() which will wait for the process to finish, collect all of its output and then returns it at one go. You're looking for .spawn() instead, to receive data as it arrives.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants