Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[bug]: shell.open doesn't detach the launched process #6849

Closed
Uzaaft opened this issue May 3, 2023 · 4 comments
Closed

[bug]: shell.open doesn't detach the launched process #6849

Uzaaft opened this issue May 3, 2023 · 4 comments
Labels
scope: core Core packages of Tauri status: needs more info Issue needs more information, discussion or reproducible example status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@Uzaaft
Copy link

Uzaaft commented May 3, 2023

Describe the problem

First and foremost: This might not be an issue with the API of Tauri, but rather how I used the API. But I've looked at the docs, and can't seem to solve this with the current API being provided, so that's why I'm opening this feature request.

I find the current method, where we use the shell api in Tauri to open files etc lacking in several areas:

  1. It has to match against a regex
  2. As soon as the program is exited, the children spawned are also closed(reported by a coworker).

Describe the solution you'd like

I'm proposing creating a new command, under the fs API, where we can open a file with the default System app, instead of the current method that's in the docs, which matches to a regex pattern. Something with an API like:

openWithDefault(path: String): Promise<void>

With no matching against a regex. We simply use the default system app.

Alternatives considered

No response

Additional context

If the maintainers of Tauri is open to the idea, I'd like to implement it myself to get the practice and experience.

@Uzaaft Uzaaft changed the title [feat]: Command for open a file with the default system app [feat]: Proposal for a new command to open a file with the default system app May 3, 2023
@amrbashir
Copy link
Member

amrbashir commented May 3, 2023

It has to match against a regex

You could specify .* as the regex to allow everything but that is really dangerous❗ and not recommended at all. Be careful to not expose your users system.

With no matching against a regex. We simply use the default system app.

The regex is only validating the path/url to be opened not the app to open with.

As soon as the program is exited, the children spawned are also closed(reported by a coworker).

Yeah this is definitely a bug that needs to be addressed upstream in open-rs crate, I will see what I can do

@amrbashir amrbashir changed the title [feat]: Proposal for a new command to open a file with the default system app [bug]: shell.open doesn't detach the launched process May 3, 2023
@amrbashir
Copy link
Member

If the maintainers of Tauri is open to the idea, I'd like to implement it myself to get the practice and experience.

Please go ahead and get in touch with us on Discord if you need any help or directions.

@amrbashir amrbashir added scope: core Core packages of Tauri priority: 2 medium status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes labels May 3, 2023
@amrbashir
Copy link
Member

amrbashir commented May 9, 2023

@Uzaaft could you post your tauri info? As far as I can tell, the launched process is detached on Windows and Unix, what is your OS?

@amrbashir amrbashir added priority: 2 medium status: needs triage This issue needs to triage, applied to new issues status: needs more info Issue needs more information, discussion or reproducible example and removed status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes priority: 2 medium labels May 9, 2023
amrbashir added a commit to amrbashir/open-rs that referenced this issue Jun 19, 2023
@amrbashir
Copy link
Member

amrbashir commented Jul 3, 2023

this will be fixed in the shell plugin for v2

amrbashir added a commit to tauri-apps/plugins-workspace that referenced this issue Jul 3, 2023
amrbashir added a commit to tauri-apps/plugins-workspace that referenced this issue Jul 4, 2023
* feat(shell): ensure launched processes are detached

ref: tauri-apps/tauri#6849

* change file
tauri-bot pushed a commit to tauri-apps/tauri-plugin-shell that referenced this issue Jul 4, 2023
* feat(shell): ensure launched processes are detached

ref: tauri-apps/tauri#6849

* change file

Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/5454181452

Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: core Core packages of Tauri status: needs more info Issue needs more information, discussion or reproducible example 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