-
Notifications
You must be signed in to change notification settings - Fork 91
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
Using "single-instance": false to avoid problems #62
Comments
wow, nice hint! didn't know - definitely should go in readme. |
Yeah, this makes sense and I didn't think of it but this then allows users to open your app multiple times, any time :/ |
This then means though that there's more of a chance that the original app is still open when the temporary app is open which deletes the files where the original app exists, which will fail if the original app is still open. But we do have code in there that retries that deletion, right @edjafarov? |
Tried that just now, works way more consistent now. Just an idea: To keep apps restricted to run in a single instance only, one might want to add this flag to the |
How? On Tue, 2 Dec 2014 12:31 Mario Ranftl notifications@github.com wrote:
|
@adam-lynch example procedure after update first start: var pkg = require('./package.json');
var fs = require('fs');
if (pkg["single-instance"] === false) {
pkg["single-instance"] = true;
fs.writeFile('./package.json', JSON.stringify(pkg), function(err) {
if (err) return console.log(err);
});
} Works on bundled (via node-webkit-builder) 32bit mac app, all other platforms untested |
@majodev ah cool, but the original app won't have |
it is for windows only, we might need to add retries for other OSes |
@adam-lynch Well it's really just an hack-y idea, I'm really not sure if this "trick" will work consistently across all platforms, so don't use it in production. It would be perfect if node-webkit provides a way to toggle the |
How about using a different package.name for each version, for instance "name": "app-v1.0.0" for old version and "app-v1.0.1" for the new one. This way nw won't interfere since it's use package.name to handle single-instance. Would you consider it a bad practice? Thx. |
Interesting @rodolfoag. I wouldn't have a new version for the each new version (that might have some side-effects depending on OS) but maybe the middle step of the updating process the name could have "-updating" on the end, but I don't know how that could even be done for just the middle step without having to download two versions of the new app. Also if we did this and apps could run alongside each other, would it help us that much? Because on Windows the first app will have to be dead by the time the next step tries to delete it / overwrite it. We might run into more problems with this, maybe this constraint makes it safer for us. |
First - thanks for your effort! While integrationg your module I had an issue which appeared sometimes - the downloaded and extracted app was not launched. I guess it's because by default node-webkit apps are single-instance only and the downloaded app was launched at a time the old app was not completely shut down. Perhaps you could mention that somewhere in the readme? This issue can be avoided with
"single-instance" : false
setting in the app's packeage json.
The text was updated successfully, but these errors were encountered: