-
Notifications
You must be signed in to change notification settings - Fork 70
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
Adds missing close callback. #10
Conversation
@@ -190,7 +190,12 @@ function run(options, callback) { | |||
|
|||
openProcesses.push(child); | |||
|
|||
child.close = function () { | |||
child.close = function (callback) { | |||
child.on("close", function () { |
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.
you don't have to register the 'close' listener at all (if there is no callback).
Also, you should make sure, that the callback in https://github.com/johanneswuerbach/sauce-connect-launcher/blob/3e30551295107cc0d531a6a656e9bc847328eb78/lib/sauce-connect-launcher.js#L186 is not called when killing the process. Eg. I call |
@vojtajina right, I didn't saw that both callbacks are available in the scope. Fixed. |
@johanneswuerbach I meant something different. There are two callbacks you can register with sauce-connect-launcher:
If an error happens when closing the process, both callbacks will be called. That's not correct, only the CALLBACK2 should get called. The CALLBACK1 should only get called if it starts successfully or if it fails to start - just once. Hope this explains it better. Also, check my comment on the outdated diff. |
@vojtajina CALLBACK1 can only be called once https://github.com/bermi/sauce-connect-launcher/blob/master/lib/sauce-connect-launcher.js#L107 |
@johanneswuerbach thanks, you are right, I missed this line! |
@bermi thanks a lot! Btw, are you guys following semver in any way ? Because these breaking changes in patch versions broke karma-sauce-launcher so I'm asking if you think it's better to set dep on fixed version of sauce-connect-launcher. Thanks for your work ! Please ping me once this gets to NPM. |
@vojtajina from the commit history I have to admit that unfortunately we have not adhered to semver strictly. Thanks for bringing that to our attention, we will stick to semver from hereon. BTW, 0.1.10 was pushed 1h ago |
@bermi Awesome, thanks ! |
In the latest version the example in the README is broken as the close callback was never executed. This PR adds a close callback.