-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Replace app with options hash to allow disabling waiting for app close #14
Conversation
@sindresorhus how do you normally ensure that the tests run? I guess there is no browser on Circle CI :( |
@sindresorhus let me know if I can do anything to fix the tests, or if this should just be merged as is? |
Sorry about the delay. Been traveling. I just enabled it on Travis to see if I would be able to set up automated testing, but got busy. Just ignore it. Will review and merge today or tomorrow. |
@sindresorhus no problem - and don't worry... I'm traveling my self, so I know how it is ;) |
|
||
Defaults to `true` and means that opn will wait calling the callback (if one is given) until the app have been closed again. If set to `false` the callback will be called immediately after the child process have spawned. | ||
|
||
Note that waiting is only possible if the app name is either `darwin` or `win32`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? Did you mean that it will only wait on OS X and Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of this set of if-sentences in the main function:
https://github.com/sindresorhus/opn/blob/a20ea1810c2805b3126134042a8ca9841284aa48/index.js#L24-L65
It seems that the support to actually wait is only available for either darwin
or win32
platforms - at least it only seem to be implemented for those two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confused by app name
. I guess you meant OS name.
But no, it will wait on Linux too, it's just default, so there's no flag.
@sindresorhus I've updated the PR with your suggestions |
Replace app with options hash to allow disabling waiting for app close
Thanks :) |
WARNING: This is a breaking change!
Fixes #2
It changes the api of the
opn
function fromopn(target, [app], [callback])
toopn(target, [options], [callback])
. The use of a customapp
is still allowed through the newoptions.app
property.It introduces a new
options.wait
boolean (default:true
) which can be set tofalse
if you do not wish the spawned process to keep your program hanging ifopn
is called with acallback
. Thecallback
will in that case be called immediately when the process have finished spawning.This PR have only implemented
options.wait
for the platformsdarwin
andwin32
. Am I correct in assuming that waiting isn't supported on other platforms?