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

[Feature Request]: Non-blocking option for shell.openPath() on macOS #42171

Open
3 tasks done
philrz opened this issue May 14, 2024 · 0 comments
Open
3 tasks done

[Feature Request]: Non-blocking option for shell.openPath() on macOS #42171

philrz opened this issue May 14, 2024 · 0 comments

Comments

@philrz
Copy link

philrz commented May 14, 2024

Preflight Checklist

Problem Description

Electron's shell.openPath() currently has an inconsistent behavior on macOS vs. Linux/Windows. The symptom is most evident with an external app that may take a long time to launch, such as with the Zui Electron app I help support where the problem can be observed with Wireshark that can take a long time to open large pcap files.

This first video reproduces the ideal behavior on Linux (and the behavior is much the same on Windows). First a user starts to open a large pcap in Wireshark, and we can see it slowly making progress on opening it by observing its filling "thermometer" and increasing counters at the bottom of the window. While Wireshark is in the middle of this long open, the user clicks to open pcap data from within the Zui app, which triggers a call to Electron's shell.openPath() that leads to attempting to open the pcap file in Wireshark. As shown here, the behavior on Linux (and Windows) is "non-blocking" such that a separate instance of the Wireshark app opens up while the first instance continues its long open.

Linux.mp4

The second video reproduces the less-desirable behavior on macOS. After repeating the same repro steps, we see that on macOS the open behavior is "blocking" such that focus simply jumps to the Wireshark that was already in the middle of its long open. The user effectively has to wait for the "long open" to complete before their separate pcap can open successfully in that single instance of Wireshark.

macOS.mp4

Proposed Solution

It seems it would be useful to offer an option to request the "non-blocking" shell.openPath() behavior on macOS so the user could see consistent behavior across all of Linux, Windows, and macOS. Based our research, it seems that this can be achieved by having Electron's shell.openPath() perform the equivalent of open -n on macOS (-n described as "Open a new instance of the application(s) even if one is already running" per the man page) rather than plain open.

Alternatives Considered

We worked around this problem for a while by creating a fork of this open project and modifying it to call open -n on macOS. However, as sometimes happens with forked/hacked code, the fork fell into disrepair over time and we've gone back to following the advice of that project's README and using Electron's shell.openPath(). However, that means just accepting the blocking behavior on macOS.

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant