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

wait doesn't work on macOS #92

Closed
kbrgl opened this issue Apr 10, 2018 · 2 comments
Closed

wait doesn't work on macOS #92

kbrgl opened this issue Apr 10, 2018 · 2 comments

Comments

@kbrgl
Copy link

kbrgl commented Apr 10, 2018

wait doesn't seem to work on macOS. With an image file opened in Preview, the Promise fulfills only when the app is quit using Cmd+Q, and not when the window with the image is closed.

To reproduce:

opn("image.png").then(() => {
  // Won't run until Preview.app is quit with Cmd+Q
  console.log("Image viewer closed.")
}

I'm running opn on Electron.

@sindresorhus
Copy link
Owner

From the docs:

Wait for the opened app to exit before fulfilling the promise.

As far as I know, there's no way to wait for a window of the app to close.

@starpit
Copy link

starpit commented Aug 16, 2018

interesting. the oddity here is that if i specify wait:true, then opn never resolves, because it cannot observe window closure; but if i specify wait:false, then opn resolves before the open actually finishes, thus resulting in the desired open possibly not occurring, as the process may exit before opn has time to complete the requested opening.

on maOS, doesn't open, without the -W flag, return immediately upon completion? thus, it seems like opn should at least wait for open to return, before resolving...

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

No branches or pull requests

3 participants